dom

how to implement a jQuery live bind event on mootools?

How do I make elements that are loaded via ajax, adopt the events associated with the same class on mootools 1.11? As far as I know, in jQquery, if your ajax response consists of something like <div class='button'>, if there is an event bind using live to $('.button'), those events would automatically bind. Is that possible with MooToo...

How to get parent of my element?

<div class="list_desc clearfix"> <div class="badge"> <div class="badgetop"> <p class="list_vote" id="l_val_1">20</p> <p class="list_vote_label">votes</p> </div> <div class="badgebottom" id="vl_1"> <div><a href="#+1"/>+1</a></div> <div><a href="#-1"/>-1</a></div> ...

in PHP, how to remove specific class from html tag?

given the following string in PHP: $html = "<div> <p><span class='test1 test2 test3'>text 1</span></p> <p><span class='test1 test2'>text 2</span></p> <p><span class='test1'>text 3</span></p> <p><span class='test1 test3 test2'>text 4</span></p> </div>"; I just want to either empty or remove any class that has "test2" in it, so the resu...

CSS Style Visibility not behaving as expected

I have a html page with a basic tab control. I use javascript to show and hide tabs and tab content divs. My problem is that if I change the visibility of an element inside one of the tab content divs to 'hidden', then back to 'visible', the element seems to forget or lose its parent div container and remains visible, regardless of its o...

How to get element by ID in IE? (Visual Studio 8?)

Using document.GetElementById(thingieID) doesn't seem to work. Can anyone help this DOM newbie? ...

Replacing dhtml element without using innerHTML

This seems like it should be easy. I have a html snippet that I wish to locate and modify in place via javascript. But not just the innerHTML; I want to replace the entire element. Example: <div class="content"> <div class="item"> <img src="images/pic1.jpg" /> <a class="clicker" onclick="javascript:doSomethingUseful...

Confusion about child nodes of documenElement in XML DOM

Hi, Consider this xml as:- book.xml <bookstore> <book category="cooking"> <title lang="en">Everyday Italian</title> <author>Giada De Laurentiis</author> <year>2005</year> <price>30.00</price> </book> <book category="children"> <title lang="en">Harry Potter</title> <author>J K...

Create a range or html fragment in IE from a string

How do I take a string and create an html fragment with it in IE. This works fine in non-ie browsers. var str = "<div>Foo</div>"; var range = document.createRange(); var frag = range.createContextualFragment(str); var e = document.getElementById("element"); e.appendChild(frag); ...

How do I get HTML corresponding to current DOM tree?

jQuery("html").html() seems to retrieves most of it, except for the wrapping tag. DOM is heavily modified, so original source is of not that much use. Is it reliable? Is it a good idea to just take jQuery's output and wrap ... around it? I can see at least some doctype problems here, and inclusion of scripts which shouldn't be rerun....

Best ways to reduce number of DOM elements

Everyone agrees that less DOM elements means better page performance. It means better javascript performance, especially in older browsers. But where are the best places to look to reduce DOM elements? What are the common culprits that you guys have come across that are easy fixes to get that number down? ...

How to get load finished event after appendChild(docFragment) which contains img tags with external links?

i have a frame element, whose src is a local .xhtml file, whose onload runs a script: // create some content var docFragment = content.createDocumentFragment(); if (docFragment) contentBody.appendChild(docFragment); where contentBody is a div in the frame's document. the content may contain images or such which load external links ...

Logic for Implementing a Dynamic Web Scraper in C#

I am looking for developing a Web Scrapper (in C# windows forms).The whole idea which i am trying to accomplish is as follows. Get the URL from the User . Load the Web page , in the IE UI control(embeddeed browser) in WINForms. Allow the User to select a text (contiguous , small(not exceeding 50 chars)). from the loaded web page. When ...

How, using jQuery, might I obtain the src attribute of a HTML img element?

When the mouse cursor moves over an image, I would like to display an alert() containing the value of that image's src attribute. How could I go about accomplishing this? ...

Odd DOM Problem with Firefox

Hello. I'm experiencing an odd problem when trying to navigate through a table's rows and cells in a while loop using javascript. I'm using Firefox 3.5.7 on Win7 with Firebug enabled. I have this markup: <table> <tbody> <tr id='firstRow'><td>a</td><td>b</td><td>c</td></tr> <tr><td>a</td><td>b</td><td>c</td></tr> ...

Stop certain elements from being edited inside a doc having designMode = "on";

I am using an iframe and setting its contendocument.designMode to "on". This allows me to replicate a Rich Text Editor, and achieve much more flexibility in the editing process. The problem is that I have certain links (<a href="#" onclick="alert(1);">test</a>) that are added to the page, and of course these links don't work because i'm...

HTML/XML Parser for Java

Hello, What HTML parsers have the following features: Fast Thread-safe Reliable and bug-free Parses HTML and XML Handles erroneous HTML Has a DOM implementation Supports HTML4, JavaScript, and CSS tags Relatively simple, object-oriented API What parser you think is better? Thank you. ...

Why is ampersand being interpreted as children on text node.

I have an xml file that I am parsing and I have the following tag... <desc> /wap/news/text.jsp?sid=242&nid=5662369&cid=5038&scid=-1 </desc> I don't have control over the format of this xml file but I need to interpret the desc content as a partial url that I will later append to a base URL and retrieve a new file. When I parse this t...

Can a signed Java Applet/Web Start manipulate content in a cross-site IFRAME?

Is it possible for a signed Java Applet or Web Start app to write to the DOM of an IFRAME under a different domain? Does the fact that they're a signed applet/javaws allow them to ignore browsers' standard cross-browser security? If this does work, how well is it supported across the major browsers? Thanks! EDIT: My motivation is to...

javascript / selenium: get the window from the document object

I am writing user extensions to selenium. I have the document object. How can I get the window object of the window that contains my document? PageBot.prototype.locateElementByMyLocator= function(text, inDocument) { // I want the window here } ...

JavaScript selection/range framework

I've been working with selection/range objects, and because to the incredible amount of inconsistencies between browsers for specific selection/range stuff (even more than the DOM) I was wondering if there was a framework that would help me get through them. ...