dom

How can I take a snapshot of a wep page's DOM structure?

I need to compare a webpage's DOM structure at various points in point. What are the ways to retrieve and snapshot it. I need the DOM on server-side for processing. I basically need to track structural changes to a webpage. Such as removing of a div tag, or inserting a p tag. Changing data (innerHTML) on those tags should not be seen a...

How do I extract all HTML tags from a webpage into an array?

I need to extract all HTML tags from a webpage into an array without the data inside the tags. It would look something like... I'm using PHP Array { html => Array { head => Array { title, ...

[Rails] Capybara doesn't recognize dynamically added DOM elements?

I seem to be having trouble testing the slick javascript things I do with jQuery when using Capybara and Selenium. The expected behavior is for a form to be dynamically generated when a user clicks on the link "add resource". Capybara will be able to click the link, but fails to recognize the new form elements (i.e. "resource[name]"). ...

PHP DomDocument alter conditional comments.

Hi, I have this html file with a conditional comment. <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="stylesheet" type="text/css" href="css/style.css"> <link rel="stylesheet" type="text/css" href="css/elements.css"> <title>Page</title> <!--[if lte IE 6]...

Select & Copy firefox content to clipboard in C or C++

I found a few questions similar to mine but none of the answers are satisfactory and they are a few years old. So I am hoping that perhaps some progress has been made on that front since then. What I am interested in is the ability to access the content of an active Firefox window and copy it to the clipboard -- using C or C++ code. In...

How to check if a value exist in selectbox using js....

Hello all, Is there any method other than running a for loop to check if a value exists in select box using js???? Im looking for something like document.getElementById('selbox').valueExists('myval'); ...

Trigger a link in adjoining table cell using jQuery

I have an HTML table where the first cell of each row contains text and the second cell contains a link. Like so: <table id="foo"> <tr> <td>Some text</td> <td><a href="/path/to/file/"><img src="/path/to/image.jpg" /></a></td> </tr> ... </table> I have a hover effect on the first table cell and when a user clicks on the f...

add javascripts and css files dynamicly to html using javascript

Hi. I am building a javascript widget and i need to add my widget css and js files dynamicly to the client page. I am doing this for now: var css = document.createElement('link'); css.setAttribute('rel', 'stylesheet'); css.setAttribute('href', 'css path'); document.getElementById('test').appendChild(css); alert(document...

Using jQuery in place of document.getElement

I would like to use $("#fooid") in place of document.getElementById("fooid") because I'm getting the id with the # in front of it. While you can remove it easily enough, there is a fair amount of intermixing between when I'm using a jQuery selector and when I'm using native DOM calls. In particular this is being called inside a cha...

Good way to navigate the DOM

Can I please get some C# code samples on the best way to navigate the DOM? My target data could be buried any where in the node. I am talking about HTML DOM. Please do not close this question. Its a serious inquiry. Thanks ...

Select element by and classname in javascript

I have an onChange event that needs to dynamically select an ID and then add a preset classname to pass to a function. onChange = "show(document.getElementById(this.value). {select a class here? } );" The equivalent in jquery $('#'+this.value+'.myclassname').function(); So how do I select an ID+classname in javascript? I know I'm ...

Should I use DomDocument for parsing html code.

I have tried my best to answer this question myself through research but I am still a little bit worried about whether I am using the right thing. Basically I am using the DomDocument Library to build a jQuery like theme parser for my framework. Now with the web as it is today HTML is coming in different shapes and sizes e.g HTML 4, HTML...

Intercepting DOM and JS engine calls

Hi All, I want to intercept DOM object read and write queries fired by JS while getting loaded by the browser. After intercepting these calls, i wish to screen them. I have written the logic for screening but am not able to block the calls. Is there any way other than modifying source code of the browser to achieve this? If so pls help...

JavaScript question

It is possible not to show html page in user browser until some JavaScript(built-in or in separate file) will be loaded and executed(for page DOM manipulation)? ...

Reference script container element?

I'm wondering if there is a way to get a handle on the DOM element that contains the script inside it. So if I had: <script type="text/javascript> var x = ?; </script> Is there a way that I can assign "x" a reference to the script element that contains "x"? ...

How to use jQuery to select this parent?

I have a recursive menu where I need the children items to effect the parent. In my example below, how do I add a "selected" class if any of the children have a "selected" class? <ul> <li class="administration first"> <a href="/administration.aspx"><span>Administration</span></a> <ul> <li class="users fir...

How to select only top-level li in recursive menu?

How do I select only first-level li's? If I do 'ul li', it also selects the children. Is there a way to select only the top level and not the children using CSS? If not, I am ok with using jQuery, but how would I select it in that case too? <ul> <li class="administration first"> <a href="/administration.aspx"><span>Administr...

How do I handle the hover in this recursive menu using jQuery?

In my menu below, I have this in my CSS: ul li ul {display:none;} When a menu item is selected, I use this jQuery to show the children menu: $('ul li.selected ul').show(); So I confused on how to handle hovers for the top level menu. When I hover over a top level menu item, how do I hide all sub-menus and show only the hovered item...

Is there a server-side dom engine suitable for crawling?

I found a project, jaxer which embeds Firefox's JavaScript engine on the server side, so it can parse HTML server-side very well. But, this project seems dead. It is really helpful for crawling web pages to parse HTML & extract data. Is there some new technology useful for extracting information? ...

load DOMDocument with HTML Special Characters (php)

Hi, i have a problem to load a xml-file with php. I use DOMDocument, because i need the function getElementsByTagName. I use this code. $dom = new DomDocument('1.0', 'UTF-8'); $dom->resolveExternals = false; $dom->load($_FILES["file"]["tmp_name"]); <?xml version="1.0" encoding="UTF-8"?> <Data> <value>1796563</value> <value>Verli...