dom

PHP's dom->createTextNode escapes some characthers

I am using dom->createTextNode() in PHP. I see that it automatically escapes characters e.g \/"" etc. According to the PHP's manual this is a standard behavior. Is it possible that it doesn't escape any characters? Thanks. ...

Can I use JavaScript to set the 'name' attribute?

According to SitePoint (and my own experiments), the IE implementation of "setAttribute()" is buggy and unreliable. Also according to SitePoint, the name attribute is read-only. Is there another way I can set the name attributes on elements? I need this for use with radio buttons. If possible, I'd like a solution without jQuery, as I...

WPF, Frame Control, HTML DOM Document access

Ive used WindowsHost to host a WebBrowser control, and that has allowed me to access the WebBrowsers Document/DOM directly, t read HTML content via mouse clicks on HTML document elements and also to invokes on submit forms. I never found a way even in Net 3.5 to do this when I was searching at the time. Ive found this post http://rhizohm...

How to retrieve all links from HTML document using DOMXPath

Hello I have this code <?PHP $content = '<html> <head> <title></title> </head> <body> <ul> <li style="border:0px" class="list" id="list1111"> <a href="http://www.example.com/" style="font-size:10px" class="mylinks"> <img src="logo.gif" width="235" height="...

JavaScript moving element in the DOM

Let's say I have three <div> elements on a page. How can I swap positions of the first and third <div>? jQuery is fine. ...

How to get top (as in locale) attribute of a DIV element using Javascript?

I have a group DIV tags in an HTML page whose location is controlled via several parent/grandparent DIVs. Those parent and grandparent's location is controlled via CSS classes. I need to retrieve the top attribute of the given DIV. Where is it in the DOM or how would I calculate it using Javascript? Clarification: I need the coord...

How to insert a DOM node a a specific character index in an existing node (with Hpricot or a similar Ruby library)

Suppose I have this HTML: html = <div>Four score and seven years ago</div> What's the best way to insert (say) an anchor tag after the word "score"? Note: I want to do this in terms of DOM manipulation (with Hpricot, e.g.) not in terms of text manipulation (e.g., no regexes) ...

How to view object's data in php

Hello when I want to test php array I use the following code print_r($myarray); but know I want to see the data of an object my object is $xpath = new DOMXPath($doc); $myobject = $xpath->query('//*[ancestor-or-self::a]'); when I use print_r($myobject); I get that output DOMNodeList Object ( ) I want to i...

How can I check my object type is Image ?

If I write something like this: var img = $(new Image()).attr('src', image.src); How can I check later if img var is an image and not something else ? ...

How to tell jQuery: When load is ready, show this?

This code: $("#permalink a").click(function(id){ var id = this.getAttribute('href'); $("#newPostContent").load(id, function() { $("#removeTrigger").click(function() { $("#removeThis").hideToggle(); $("#postSingle").hideToggle(); }); }); $("#postSingle").fadeToggle(); return false; }); Shows #postSingle before the load functi...

FireFox / JQuery / Dom : Not returning 'rowIndex.

I am writing a JavaScript function to highlight the row and column of a clicked cell. This function must take into account cells in previous rows that use "rowspan" to protrude down into the selected row - because this causes the cell indexes to differ from the "apparent" index. I.E. every cell in the second column of a table does not ...

PHP Scraping Page

I'm trying to scrape a page where the information I'm looking for lies within: <tr class="defRowEven"> <td align="right">label</td> <td>info</td> </tr> I'm trying to get the label and info out of the page. Before I was doing something like: $hrefs = $xpath->evaluate("/html/body//a"); That is how I'm grabbing the URL's. Is t...

Hierarchical object model with property inheritance and event bubbling?

I'm writing a document-based client application and I need a DOM or WPF-like, but non-visual model that: Is a tree composed of elements Can accept an unlimited number of custom properties that get/set any CLR type, including collections. Can inherit their values from their parent Can inherit their default values from an ancestor Ca...

Spliting child node from XML file into their own XML files

I have an XML file below and I want to create multiple files: <ParentNode> file1: <ChildNode> <ParentNode> <node></node> <ChildNode> </childNode> <node></node> <ChildNod...

Jquery attribute selector

I have a variable (div element) which contains some table html. I can use this javascript to add a class to each cell that has a background set. var tds = tempDiv.getElementsByTagName("TD"); for (var j = 0; j < tds.length; j++) { var oTd = tds[j]; if (oTd.style.background.length > 0) { oTd.className = 'faketh'; ...

Removing DOM nodes when traversing a NodeList

I'm about to delete certain elements in an XML document, using code like the following: NodeList nodes = ...; for (int i = 0; i < nodes.getLength(); i++) { Element e = (Element)nodes.item(i); if (certain criteria involving Element e) { e.getParentNode().removeChild(e); } } Will this interfere with proper traversal of the Nod...

C++ writing HTML onto each of two already opened Firefox tabs from within extension

I'm seeking C++ help in writing HTML code to a new tab in Firefox within an extension. Our C++ code has been partially wrapped by an XPCOM wrapper and embedded within a Firefox extension thanks to the work of a consultant we have lost contact with, and still partially implemented by calling out to a standalone executable. To get our ou...

jQuery returns true for "is:empty" check on appended html

A user can upload a picture on my site at which point jQuery inserts it into the page with append(). After appending I need to able to determine if there is something there or not, but jQuery's "is:empty" check returns true despite content having been appended. If I reload the page, the "is:empty" check will return false. It seems tha...

Facebook form post data not present on backend

I am attempting to post form data to my app using Facebook. My form is integrated with a dialog and I am using form.submit() to submit the form. Please see my code. The post data does not appear on the backend (e.g. load-cargo-radio, city-id, train-id), but the fb_sig* data does. Does anyone know if there are any caveats regarding postin...

Is checking for the readiness of the DOM overkill?

I'm developing a platform for developing desktop apps with web technologies. In the course of doing so I've been trying to get some document/on-ready functionality working with the browser I will be integrating into the platform. That's why I'd previously asked this this question here on SO: javascript-framework-that-primarily-provides...