dom

How can I get the x/y coordinates of an SVG element(path etc) that does not have the X/Y attributes?

Hi! I am trying to get the position of SVG elements using Javascript. I have managed to get the position on elements that have X/Y attribute set. But elements, such as paths does not have this attribute.. At least not in my docuements. Is there a way to calculate the position other than taking the first number in the "path"? Thank you...

Finding out inside which iframe a script is executing

I have a page with several iframes. One of this iframes has a page from a different domain. Inside this iframe there's another iframe with a page from the parent domain. my page from mydomain.com -> an iframe -> iframe "#foo" from another-domain.com> -> iframe "#bar" from mydomain.com -> another iframe I need to get a refere...

Do I have to clean custom properties (Expandos) on window.onunload event?

Hi, In one article I have seen that it may be good to clear all expandos on window.unload event to prevent memory leaks. I cannot understand why to do this. Isn't the browser cleaning all the DOM and its relevant resources of it once you leave the page anyway? Thanks, burak ozdogan ...

highlight the text of the DOM range element,

I am able to highlight the text on the HTML page(rendered through gtkmozembed), which is selected, like below. var range, sel; if (window.getSelection) { sel = window.getSelection(); if (sel.getRangeAt) { range = sel.getRangeAt(0); } document.designMode = "on"; if (range) { ...

Memory leak in Mozilla when unloading stylesheets

I'm working with Mozilla v1.7.12 on a constrained device (a Motorola set-top box) trying to resolve some memory leaks. When I dynamically load a stylesheet which refers to some large images, I can see that the amount of consumed memory increases in correspondance with the size of the images. This is what I would expect. Then, when I re...

DocumentBuilder.parse() / Parsing Entities

I'm new to parsing XML and am having an issue with entities. (Am doing this on Android, if it makes a difference). Is there a way to have it turn an entity into the character it represents? I have this in the child of an element: "isn't" (minus quotes). I would prefer it parse it and the end result be a single text node. However, r...

Getting the correct node

Hello I have this structure in my dom: <label>London<input type="checkbox" name="London"></label><br> <div class="innerpost"> <label>N1 2AB<input type="checkbox" name="N1 2AB"></label><br> <label>E1 1AB<input type="checkbox" name="E1 1AB"></label><br> </div> I need a way to select the div from the first checkbox. Something like ...

Setting <td> value using jquery

Hello, I have the div structure shown below. For the second <td> in the table i want to replace &nbsp; with a hyperlink whose href attribute is stored in the variable myLink. How can i do this with jquery ? Please help. Thank You. <div class="pbHeader"> <table cellspacing="0" cellpadding="0" border="0"> <tbody> <tr> ...

jQuery: Trouble inserting DOM elements

I want to add a set of lists to the children of another DOM element: var req_subsets = $("#req_subsets"); $.each(subsets, function(index, subset) { var subset_list = $("<ul></ul>"); // add DOM elements to subset_list req_subsets.append(subset_list); }); However, only one DOM element is ever adde...

Word on HTML document point, using UIWebView, DOM and Javascript

Hey guys, How can I figure out which word is at the point where the user tapped on a UIWebView? I am able to detect the CGPoint for the tap (subclassing UIWindow like this), and I can actually get the DOM element on that point using javascript. But I know very little of javascript and DOM to figure out how can I actually get which wo...

Is it possible to extend the DOM of a new window opened using window.open without loading prototypeJS in the new window?

Hi! Is it possible to extend the DOM of a new window that I opened, using something like this: var newWindow = window.open('about:blank', 'testWindow', ''); Element.extend(newWindow); I thought Element.extend would work.. But I done see any refference to prototype in the DOM. Any ideas? Thank you! Morten ...

execCommand not working for xml file

I am using execCommand command to 'Hilite' selected text on the page which is rendered with gecko engine/gtkmozembed. if ( !document.execCommand("HiliteColor", false, colour) ) { document.execCommand("BackColor", false, colour); } This is working fine with HTML pages. But i have some XML pages( books in xml format). ex...

Chrome: Dynamically created <style> tag does not have content?

Hello. I encountered a weird problem when trying to write a cross-browser script. Basically my header looks like this <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"&gt;&lt;/script&gt; </head> Then in the body tag: <p id="hey">Hey</p> <input type="button" value="attachStyle" name="attachSty...

How do you query namespaces with PHP/XPath/DOM

I am trying to query an XML document that uses namespaces. I have had success with xpath without namespaces, but no results with namespaces. This is a basic example of what I was trying. I have condensed it slightly, so there may be small issues in my sample that may detract from my actual problem. Sample XML: <?xml version="1.0"?> ...

Detect page load completed event in Firefox

I'm writing a Firefox add-on that do something after the webpage is completely loaded.My current code is var target = this; const STATE_STOP = Components.interfaces.nsIWebProgressListener.STATE_STOP; const STATE_IS_WINDOW = Components.interfaces.nsIWebProgressListener.STATE_IS_WINDOW; const STATE_IS_DOCUMENT = Components.int...

How to Canonicalize a Stax XML object.

Hello, i want to Canonicalize a Stax object, the program it's doing it with DOM, but dom can't manage big XML documents (like 1GB), so STAX it's the solution. The Code that i have it's: File file=new File("big-1gb.xml"); org.apache.xml.security.Init.init(); DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); Docu...

Dom Traversal to Automate Keyboard Focus - Spatial Navigation

I'm going to start with a little background that will hopefully help my question make more sense. I am developing an application for a television. The concept is simple and basically works by overlaying a browser over the video plane of the TV. Now being a TV, there is no mouse or additional pointing device. All interaction is done th...

Elements added with appendTo() not immediately available

I'm having a problem with elements added with appendTo() not being immediately available in the DOM. First, I'm reading some data from a JSON file and then appending some html to a div. Then I'm calling a random shuffler plugin to show one of the added divs at a time. jsonUrl = "js/performers.json"; $.getJSON(jsonUrl, functio...

A question about DOM parser used with Python

I'm using the following python code to search for a node in an XML file and changing the value of an attribute of one of it's children.Changes are happening correctly when the node is displayed using toxml().But, when it is written to a file, the attributes rearrange themselves(as seen in the Source and the Final XML below). Could anyone...

Proper way to communicate between divs in jquery?

This is probably a simple question, and i'm just being dense. I've looked through a few jquery books and nothing has jumped out at me, i'm probably missing something. I'm looking for the 'proper', best practices way to communicate between divs/dom items on a page? For example, I have a page with 5 panels that display when a link is cho...