dom

What is the runtime of `Node.insertBefore`?

I realize that each browser would implement it differently, but are there any references or benchmarks that specify this? The simplest implementation would seem to be O(n) in the number of children of Node EDIT: I ran some benchmarks. Here are the results FireFox 3.6.10 on Linux inserted 1000 elements into 1000 elements in 131.44 ...

Is it possible to edit DOM elements that get loaded via an <iframe> with jQuery?

I have the following HTML code: <body> ... <div id="users"> <iframe src="http://control.intranet/userlist.php" height="100"> </div> ... </body> Where the //control.intranet/userlist.php loads a list of users from our intranet control panel. This list looks like this: <div class="user"> <span class="name">Boda Cydo<...

What is the best way to post contents of an ordered list on html form submission?

In the past I have always used a hidden field, and on the submit button onClick event I stuff the list contents (the text of the li elements) into a hidden form field using custom code, and parse it out on the server-side using custom code. This has always felt like a hack and I was wondering if there is a more modern approach. I'd lik...

How to replace a HTML-tags inner text content using C#!

Hello! Right now I'm working on a Internet Explorer add on which is supposed to scan a HTML-document for URL's in plain text, and then "linkify" them. I have access to the websites DOM, and had an idea to traverse all of the DOM nodes and search for "links" using RegEx, to replace these text with HTML-code, however, when changing the "...

Add nodes to an xml at runtime?

I am writing an application that must update parts of an already existing xml file based on a set of files in a directory. An example of this xml file can be seen below: http://izpack.org/documentation/sample-install-definition.html In the below scope a list of files is added and its specified if they should be "parsable" (used for par...

Probable DOM issue trying to hack a google books preview into MediaWiki

Firstly here is what I am trying to add to my mediawiki skin. http://www.urbanvintner.co.nz/books/ It's a quick and dirty hack of Simple Modal using Google's Book Preview and Dynamic Link APIs. Problem being I can't for the life of me figure out how to address the elements within the mediawiki installation. At least I'm assuming thats...

Is there a way to validate the HTML of a page after AJAX operations are performed on it?

I'm writing a web app that inserts and modifies HTML elements via AJAX using JQuery. It works very nicely, but I want to be sure everything is ok under the bonnet. When I inspect the source of the page in IE or Chrome it shows me the original document markup, not what has changed since my AJAX calls. I love using the WC3 validator to ...

Parse HTML with PHP's HTML DOMDocument

Hi guys This is my example script: $html = <<<HTML <div class="main"> <div class="text"> Capture this text 1 </div> <div class="date"> May 2010 </div> </div> <div class="main"> <div class="text"> Capture this text 2 </div> <div class="date"> June 2010 </div> </div> HTML; $dom = new DOMDo...

Where do .detach-ed objects go?

I have something like this: //html <div class="panel"> <div class="tools"> <a href="#action1">Action 1</a> <a href="#action1">Action 1</a> <a href="#action1">Action 1</a> </div> <div class="list"> <table>...</table> </div> </div> //JavaScript (jQuery) var lookup = $('.panel'), butto...

Add an event listener to an object that is added to the DOM via AJAX

Hi There, I've got a set of checkboxes that are added to a document via an Ajax call <input type='checkbox' checked class='import'> <input type='checkbox' checked class='import'> <input type='checkbox' checked class='import'> <input type='checkbox' checked class='import'> <input type='checkbox' checked class='import'> I've got a few...

Selecting a node in Raphael javascript

Hi, the following code mostly works (thanks to a good answer a couple of days ago!) all except for the last little bit: things.square[1].node.setAttribute("id","clicker"); $("#clicker").click(function(){ $("#canvas_things1").fadeOut(); $("#canvas_things2").fadeIn(); }); I think the problem is this line: things.square[1].node....

Dynamically replace the “src” attributes of all <img> tags (redux)

Possible Duplicate: Dynamically replace the src attributes of all <img> tags Funny story: I posted this very question a short time ago, but instead of getting something I could, you know, use, all I got was a lot of dogma about the evils of using regex to parse HTML. So here goes again. I have some HTML and want to replace th...

xpath query to parse html tags

I need to parse the following sample html using xpath query.. <td id="msgcontents"> <div class="user-data">Just seeing if I can post a link... please ignore post <a href="http://finance.yahoo.com"&gt;http://finance.yahoo.com&lt;/a&gt; </div> </td> <td id="msgcontents"> <div class="user-data">some text2... <a href="http://abc.com...

How to detect and remove unnecessary xmlns:<something> attributes in PHP DOM?

Say I have a source document like this: <element> <subelement xmlns:someprefix="mynamespace"/> </element> The xmlns:someprefix is obviously not needed here and doesn't do anything since that namespace is not being used anywhere in the document. In PHP, after I've loaded this into a DOM tree with DOMDocument->loadXML(), I'd like to ...

JavaScript "null or not an object" error

I'm running the following javacript below to place horizontal scrolling text on the banner of my website. it works in on server and not another. I get the following error: Error: 'this.mqo' is null or not an object JavaScript: function start() { new mq('m1'); /* new mq('m2'); */ mqRotate(mqr); // must come last } wind...

liveQuery not reloading DOM until a second after pageload together with .load which causes a short visual error

This is a small issue which started to appear in most browsers (as far as I know) after I added the liveQuery library together with the jQuery .load function. LiveQuery is working just fine but since I have a opcaity effect on my portfolio that upon pageload lowers the opacity down to 0.6 on my thumbs via the following code; // LiveQue...

how to access the dom of a popup in IE8

Once you open a window using window.open, how do you access the dom of the popup ...

PHP Simple HTML DOM Parser

Hi Guys, How come you can't use the Class's traversing methods with variable's to set the parameters For instance Using this array: array(0 => array('element' => 'img[src=images/more.gif]', 'attribute' => 'parent()->href')); this works: foreach($this->contents->find($target[$key]['element']) as $keyz => $found) { $this->store[$ke...

Get a specific child tag from a DomElement in PHP

I am walking through a xml definition file and I have a DOMNodeList that I am walking through. I need to extract the contents of a child tag that may or may not be in the current entity <input id="name"> <label>Full Name:</label> <required /> </input> <input id="phone"> <required /> </input> <input id="email" /> I need to replac...

IE v. FF: Is table.tBodies[0] valid?

From what I gather, tBodies[0] seems to work in IE, but not FF. Is this an IE mistake? I've created a small file to demonstrate the incosistency, and I would like to know the best way to go about this. The HTML: <html> <body> <table id="dataGrid"> </table> <input type="button" onclick="insertRow();" value="New row"> </body> </html...