dom

How to Integrate DOM into V8 engine?

Im in the process of developing Browser for ARM Device. I've done rendering of pages and basic javascript executions using V8. Now am in the process of Integrating Javascript DOM. Is any independent library version (.so) of DOM available? ...

get textNode of a elementNode of a web page via javascript

In a web page,i want to get every visible text in a textnode.I don't want to put all the result into one array.I mean, when i meet a visible text, i will do something else. How could i achieve it? ...

DOM memory issue with IE8 (inserting lots of JSON data)

I am developing a small web-utility that displays some data from some database tables. I have the utility running fine on FF, Safari, Chrome..., but the memory management on IE8 is horrendous. The largest JSON request will return information to create around 5,000 or so rows in a table within the browser (3 columns in the table). I'...

What damage is done by document.write()?

What bad things happen at the moment document.write() is invoked? I've heard bits and pieces about document.write having an adverse impact on the DOM or on the use of Javascript libraries. I have an issue in front of me that I suspect is related, but have not been able to find a concise summary of what damage the method does. ...

jQuery - How to remove a DOM element BEFORE complete page load

Now this may seem like a silly question, but I need to know how to remove a DOM element BEFORE it is displayed to the user. In short, I am using a div that has a background image alerting the user to enable javascript before proceeding. If the user has javascript enabled I am using jQuery to remove the DOM element, in this case $(".check...

Is document.links faster in finding a link using jQuery?

Is this faster: $(document.links).filter('a.someClass') than just plain old this: $('a.someClass') ? I don't see anywhere in jQuery's code the utilization of document.links which gives you the collection of links on the document right away, than, it would seem, it would be faster to just filter in the collection instead of all the...

Browser Dom Selection in C# Windows Forms App

I'd like to build a windows forms app to allow users to make selections within the Browser object. I'd like to capture their selection (by index or DOM element - no too picky at this point) and use this information to query content from the page. How can I capture the DOM selection from my C# app code? ...

Catch all DOM events on a page (without Firebug et. al.)

How would I go about creating a cross-browser script, that would intercept all events firing on a page/browser window/DOM-tree (regardless of browser)? What I'm hoping to accomplish is basically to get a better understanding of the different handling of events in different browsers; I know the basic theory, but need to see to believe......

Using window.onscroll event to detect page/frame scrolling

I want to postion a DIV inside a page such that it is visible to the user even if the user vertically scrolls the page. The page has a heading at the top of the page which is 75 px tall. Now when the user is at the top of the page and has not scrolled vertically, the DIV must be postioned below the heading. However, once the user scrol...

Get entire text of document as a string using javascript

I am developing a firefox extension and ideally would be able to get the whole darn DOM as a string.. forget any data structure. I just want what I see in "view source" in a buffer. I have been checking out javascript references and HTMLDocument etc. with no avail. Ideally I would be able to write to this buffer as well (seems possible...

Get the value of a textnode which is being shown on the screen via javascript.Not very easy.

I mean, assume a web page is very long and contain lots of words, now i just want to get the value of a textnode which is being shown on the screen.How could i do it? Thanks! :) what's more: I mean, i know how to get the value of a textnode,but if a web page is very lage and contains thousands of words, what i want to do is that,only ge...

VBScript and JScript seem to handle element.click method in a different manner. Why?

Hi, guys. Here's another sample script in VBScript. It opens internet explorer, navigates to google, sets up a search field and submits a query. set ie = CreateObject("InternetExplorer.Application") ie.navigate("www.google.com") ie.visible = true while ie.readystate <> 4 wscript.sleep 100 WEnd set fields = ie.document.getelemen...

How to get a div via PHP?

Hello. I get a page using file_get_contents from a remote server, but I want to filter that page and get a DIV from it that has class "text" using PHP. I started with DOMDocument but I'm lost now. Any help? $file = file_get_contents("xx"); $elements = new DOMDocument(); $elements->loadHTML($file); foreach ($elements as $element) { ...

Extending DOMDocument and DOMNode: problem with return object

I'm trying to extend the DOMDocument class so as to make XPath selections easier. I wrote this piece of code: class myDOMDocument extends DOMDocument { function selectNodes($xpath){ $oxpath = new DOMXPath($this); return $oxpath->query($xpath); } function selectSingleNode($xpath){ return $this->selectNodes($xpath)->item(...

Why element creation requires the document object in DOM?

As noted by others, in Java, with the default W3C DOM libraries, one is required to use the Document object a factory to elements, i.e.: import org.w3c.dom.Document; import org.w3c.dom.Element; Document d; Element e; e = d.createElement("tag"); Why is that necessary? Why conceptually a method can't create an XML element without...

jQuery child selector expression

<div id="div"> <div> <!-- first level --> <div> <!-- second level --> <div>1.1</div> <!-- third level --> <div>1.2</div> </div> <div> <div></div> <div>2.2</div> </div> </div> </div> What are the jQuery selector expressions for selecting the followin...

Firefox: how to apply XSLT from plugin to opened XML document? (how to replace document with another?)

Hi! I've developed a plug-in for Firefox, that can read and manipulate the content of the currently opened document. I would like to apply a XLST to the document in case it is XML. I have no problem to read the XML document and apply a XSLT to it in memory, however, I have no idea of how to replace the existing document with the newly c...

Possible to modify DOM during/before initial DOM parsing?

Is it possible to modify the DOM during or before the initial DOM parsing? Or do I have to wait until the DOM is parsed and built before interacting with it? More specifically, is it possible to hinder a script element in DOM from running using userscripts/content scripts or similar in chrome or firefox? Tried using eventListeners on DO...

How can I submit a DOM table to php?

Hi, I have a <table> in a web page that I populate using JavaScript code like this: var cellBarcode = row.insertCell(1); var textNode = document.createTextNode(barcode); cellBarcode.appendChild(textNode); var cellItemName = row.insertCell(2); var textNode = document.createTextNode(itemName); cellItemName.appendChild(textNode); I need ...

getElementsByTagName() equivalent for textNodes

Is there any way to get the collection of all textNode objects within a document? getElementsByTagName() works great for Elements, but textNodes are not Elements. Update: I realize this can be accomplished by walking the DOM - as many below suggest. I know how to write a DOM-walker function that looks at every node in the document. I ...