Tag: dom

HTML DOM Text() nodes

I need to get a handle on the element given the path to the text node or Xpath. I use the following method to return the element. result.singleNodeValue; returns null if there are multiple childNodes present, can I merge them into one? function xpathElement(expr) { var resolver = function (prefix) { if (“xhtml” == prefix) […]

Javascript listener to capture URL of currently loading resource

Is there any way to capture URLs of currently loading resource in javascript. For example, if browser starts downloading a JS, CSS or IMG file then is there any way we can get notified which resource is being loaded? Something Like: window.onResourceLoad = function (e) { alert(e.URL); }

In what standard is specified that elements with an id also get a global variable?

This question already has an answer here: Do DOM tree elements with ids become global variables? 4 answers Is there a spec that the id of elements should be made global variable? 5 answers

How to see the DOM generated by javascript using htmlunit?

I have got an html page in which the UI is generated using javascript.I am interested in a form which is visible when the page is inspected using developer tools but not in html source. In htmlunit i tried to wait for the javascript to execute and then print it as Xml but DOM elements […]

Render HTML in Javascript without Changing the DOM

I doubt this is possible, but I’ll ask anyway. Let’s say I have a custom HTML tag “location”, that I want to render a certain way, without actually altering the DOM. For example: <location loc-id=”14″ address=”blah” zipcode=”14″ /> Would render the equivalent of: <div class=”location”> <div>Blah></div> <div>14></div> </div> I know I could extract the data […]

Speed issues with ngRepeat. Is it possible to reuse a DOM-part in AngularJS?

I am displaying a list with a lot of data and it is getting very slow very fast (>5 entries = too slow). I tinkered around a little bit and found that not the amount of data is the problem but the many DOM elements that are generated. I show a table with just some […]

Trying to remove jQuery

This question already has an answer here: Using querySelectorAll to retrieve direct children 8 answers

(Why) does accessing outerHeight cancel click/mouseup/focus event?

I’ve encountered a weird issue – accessing any DOM element’s outerHeight, or simply loggin that element to browser’s console in a blur event seems to cancel the click event that caused the blur – when some special criteria is met. Here’s what I’m trying to do: There are 2 inputs, first is initially visible, the […]

How to send a post request for file input in javascript?

I wrote this program to help me send post request by javascript only the elements with send class will be sent I store all data in a variable, because this can be re-used in another ajax function. and then use it to create form and send it out. this can send any data in the […]

How to tell if a DOM element is visible in the current viewport?

Is there an efficient way to tell if a DOM element (in an HTML document) is currently visible (appears in the viewport)? (The question regards Firefox)