dom

JQuery going through a set of UL and dynamically set ids incremently on each one

I have an unordered list which contains serveral items called 'oListItems' the UL has a class but no id. The class OuteroListItems contains many of oListitems oList.AppendFormat("<ul class='OuteroListItems'>"); oList.AppendFormat("<li>"); oList.AppendFormat("<ul class='oListItems'>"); oList.Appen...

PHP - DOM class - numbered entities and encodings problem

Hi guys, I'm having some difficult with PHP DOM class. I am making a sitemap script, and I need the output of $doc->saveXML() to be like <?xml version="1.0" encoding="UTF-8"?> <root> <url> <loc>http://www.somesite.com/servi&amp;#xE7;os/redesign&lt;/loc&gt; </url> </root> or <?xml version="1.0" encoding="UTF-8"?> <ro...

Javascript detect event handlers available on HTML element

Is there a way to detect what event handlers are available natively for an HTML element? For example: isAvailable(img.onload) === true; // All browsers isAvailable(script.onload) === true; // Non-IE only (Webkit, Firefox, Opera) isAvailable(link.onload) === true; // IE (and I think Opera) only Ideally I want to do feature detect...

Click at link by address template

Hello, I'm using Selenium for making some work: script should click at link followed by it's own address. For example, there is a method: clickAndWait. I have to pass it link title. But at my page this title changes, so I have to pass address to click at. Could you help me with this? p.s. I asked this question in selenium group, but st...

Problem with dynamically added script element - attribute src is empty

Hi there, I have a problem with dynamically added script element (using jQuery). Code for adding new script element to DOM is this: var pScript = document.createElement("script"); pScript.type = "text/javascript"; pScript.src = sFile; // Add element to the end of head element $("head").append(pScript); The script is added with no p...

How do you traverse through a list which is in a plugin - JQuery Related

Ok so I have created a plugin which has an unordered list of list items, each list item has a class to identify it. The plugin so far is able to get the unordered list in its entirety, but suppose i wanted to select 2 of the list items only which have classes associated to them. How would I accomplish this. Here is my plugin, I tried u...

Twitter RSS feed, [domdocument.load]: failed to open stream:

hi i'm using the following: <?php $doc = new DOMDocument(); $doc->load('http://twitter.com/statuses/user_timeline/XXXXXX.rss'); $arrFeeds = array(); foreach ($doc->getElementsByTagName('item') as $node) { $itemRSS = array ( 'title' => $node->getElementsByTagName('title')->item(0)->nodeValue, 'desc' => $node->getEl...

Retrieving information from DOM elements returned using ajax

I am new(ish) to jQuery and am testing out the extraction of DOM element data using jQuery. Below, detailed on the firebug console I tried to extract data 10 different ways (from 1- to 10-) using data returned directly from the ajax request (rtnData). And then to compare, I wrapped (rtnData) in a div to make it a jQuery object, and sto...

Javascript - how to change elements content inside a page when using iframes, using dom, not jquery

Hello all, I have this iframe and as u can see it call a js function with the onload trigger. <iframe name="top" id="top" width="99%" height="20%" src="top.htm" frameborder="0" scrolling="no" onload="log_in()"></iframe> What i need to do is to effect the element inside "top.htm" (change innerHTML and stuff like that) from that functi...

Javascript: How to calculate the exact position of the viewport?

My problem is I need to get the position of the viewport relative to the extent of the entire document. I am only concerned with Firefox. My issue is that everything I have read says that: viewport height is window.innerHeight scroll position is window.pageYOffset document total height is document.height So, I would expect that if ...

"Permission denied to access property 'href' from a non-chrome context" in JavaScript and OpenLayers

This is really two questions one leading into the other. Firstly what does 'Permission denied to access property 'href' from a non-chrome context' actually mean? Secondly I am using overlays in OpenLayers and wish to change the opacity of said layers, this is where this error is being thrown the code of which is here... <input id='opac...

How to Manipulate DOM of Applet's Web Page?

Is there any way to manipulate, from an Applet, the DOM of a HTML page that hosts that applet? When a say manipulate, i want, for example, to create new elements in the HTML's page ...

Touch events are not triggered on video tags on safari for iPhone

I want to prevent the scrolling on a safari web page for iphone by binding the preventDefault method on the document element of the DOM, and it works on every elements but the video tag. document.addEventListener("touchmove", function(e){e.preventdefault();}, false); I've tried attaching the event to the video tags, but it seems as if...

Using getElementsByName without starting at document root.

Is there a way to use getElementsByName without starting from the DOM root. For example I have a div element, and want to start searching from that element. If not, then do I have to write my own function that recursively iterates through the child nodes, or is there a different way to do it. ...

Is there a way to determine when CSS parsing/rendering has completed?

Wondering for benchmarking purposes if there is a DOM event or other way to determine when the browser has finished parsing/rendering the CSS. I'm trying to optimize CSS selectors and need a way to measure the drawing/rendering/reflowing times. Thanks. ...

HTML Double Click Selection Oddity

I didn't post this on DocType because it's not really a design thing, the visual representation isn't my problem, the behaviour is. I'm sorry if this is misplaced but I don't feel it's a designer issue. The following DOM: <ul style="overflow: hidden;"> <li style="float: left;"><strong>SKU:</strong>123123</li> <li style="float: le...

Creating and appending a big DOM with javascript - most optimized way?

I use the following code to append a big dom on a mobile browser (webkit): 1. while(i--) // 'i' ranges from 10 to possibly 1000 2. { 3. var html01 = ['<div class="test">', someVal[i],'</div>', 4. '<div><p>', someTxt.txt1, anotherVal.val[i], '</p></div>', 5. // lots of html snippets interspersed with variables that d...

accessing id property via javascript

Dear experts Is there a way to access the ID of an dom element? I don't mean using the getElementById attribute to find out a array of objects. Bascially I already know the DOM element and that object reference is at hand. All I need is to access the ID property. I know something like if(element.id==value) won't work. Thanks in ...

Javascript function to add class to a list element based on # in url.

I am trying to create a javascript function to add and remove a class to a list element based on the #tag at the end of the url on a page. The page has several different states, each with a different # in the url. I am currently using this script to change the style of a given element based on the # in the url when the user first loads ...

Javascript event execution order

What is the execution order of inline events, attachEvent handlers, and an <a> tag's href navigation? ...