dom

DOM memory and CPU management

I am creating a progressively built single-page (if Javascript is enabled) "blog" which uses AJAX to request HTML for new pages the user is navigating to. When the user navigates to new pages they will be added one after another into the DOM in a small window with "overflow: hidden;": <div id="foo" style="width:200px; height:100px;"> ...

How to subscribe for an javascript event form Flex 3 action script code?

Hello, everyone. We have that Flex app talking to the server. We need some kind of *FlexEvent.ON_BROWSER_WINDOW_CLOSE* event but, unfortunately Flex does not provide such. So I've got the advice to catch a javascript "onbeforeunload" event and call the flash client thru the ExternalInterface-registred method. Is there any way to subsc...

How do I monitor the DOM for changes?

Is there a way - using jQuery or otherwise - to monitor the DOM for insertions, deletions, updates to styles, etc? ...

Java XML Node Edit without Node.getTextContents()

I'm using an old version of the JRE (1.4) where Node.getTextContents() and Node.setTextContents() are not available. Is there a long way to do these actions still? Example XML: <MyEle>4119<MyEle/> Java: //myEleNode is a Node found while traversing String nodeString = myEleNode.getTextContent(); if(nodeString.equals("4119")){//do so...

HTML Parsing Libraries for .NET

I'm looking for libraries to parse HTML to extract links, forms, tags etc. http://www.majestic12.co.uk/projects/html_parser.php http://www.netomatix.com/Products/DocumentManagement/HtmlParserNet.aspx http://www.developer.com/net/csharp/article.php/2230091 LGPL or any other commercial development friendly licenses are preferable. Hav...

Multi-Threaded Client-Server Web Service - Making server side data thread-safe

Hi All I am implementing a multi-threaded web service. A thread is spawned per incoming request. For each client, a session is created and each session contains a data section - say a DOM tree. Client requests will basically be get/set methods and the server will read/write the DOM. So the DOM data is per client. Now my question is, s...

Nokogiri: Navigating the DOM.

I'm trying to fill the variables parent_element_h1 and parent_element_h2. Can anyone help me use the Nokogiri Gem to get the information I need into those variables? require 'rubygems' require 'nokogiri' value = Nokogiri::HTML.parse(<<-HTML_END) "<html> <body> <p id='para-1'>A</p> <div class='block' id='X1'> ...

Is there a way to change the contents of elements when they are selected?

Is it possible to change the contents of elements when they, or a part of the text within them, is selected then reverting them back when they are deselected? The aim being that when they are copied to the clipboard the alternate value is copied. The html looking something like this: <p>Today is the <span class="date" value="18/03/200...

Why does this move the elements 4 times?

Why doesn't this work right? The effect I am trying to achieve is the blocks move from left to right, and start "pushing" the next ones along. It seems to be a problem with nested callbacks performing animations on the outer elements. Can anyone explain this? It sorta works, but everything moves too many times. <html> <head> <style> .i...

speeding up multiple onmouseover events in IE

I have a web page with many (up to 100+) html elements on it. Each one has an onmouseover event registered to fire to do some logic and rendering depending on which element is hovered over. I am finding that in IE the more onmouseover events that are regitered the longer they take to fire. In Firefox the speed is fine and in Chrome ev...

How to get nodes lying inside a range with javascript?

I'm trying to get all the DOM nodes that are within a range object, what's the best way to do this? var selection = window.getSelection(); //what the user has selected var range = selection.getRangeAt(0); //the first range of the selection var startNode = range.startContainer; var endNode = range.endContainer; var allNodes = /*insert ma...

DOM libraries in .Net for building SQL statements

Are there any libraries for .Net for building sql statements? (BTW I know about ADO.NET SqlCommand, SqlParameter classes already) I'm currently developing a library to do this but am now wondering if there is already something out there which might be better. Edit: At this point I'm only interested in returning a DataTable object as...

Deep cloning vs setting of innerHTML: what's faster?

I'm trying to figure out the most performant way of deep-cloning a DOM tree within the browser. If I start out with var div = document.getElementById("source"); var markup = div.innerHTML; What will be faster, var target = div.cloneNode(true); or var target = document.cloneNode(false); target.innerHTML = markup; I understand th...

Change textNode value

Is there any way to change the value of a DOM textNode in web browser? I specifically want to see if I can change the existing node, rather than creating a new one. To clarify, I need to do this with Javascript. All text in the browser is stored in #textNodes which are children of other HTML nodes, but cannot have childr nodes of their...

How can I detect a Scrollbar presence ( using Javascript ) in HTML iFrame ?

How can I detect a Scrollbar presence ( using Javascript ) in HTML iFrame ? I have already tried : var vHeight = 0; if (document.all) { if (document.documentElement) { vHeight = document.documentElement.clientHeight; } else { vHeight = document.body.clientHeight } } else { vHeight...

Why does document.getElementById('hyperlink_element_id') return the value of the hyperlink's href attribute?

I'm trying to grab the Web.UI.WebControls.HyperLink object itself via javascript so that I can modify its ImageUrl. Here I'm setting the hyperlink's NavigateUrl to the my javascript function call: lnkShowHide.NavigateUrl = String.Format( "javascript:ShowHideElement('{0}');", lnkShowHide.ClientID ) Here's my javascript function: ...

Why is my TinyMCE hidden textarea acting up?

I have about 7 textareas on a web page, all of them are rich text editors using TinyMCE. However at page load only 1 of them is visible and the rest of them hidden. The user can click a 'show' link which would display the remaining textareas one by one. However, I have a weird problem. All the textareas are setup like this: <textarea c...

Reference parent window document

Hi there, I'm trying to access the parent window document from a popup. <script type='text/javascript'> $(document).ready(function(){ var summary = window.parent.document.getElementById('summary'); var content = summary.innerHTML; }); </script> Is it even possible? Is there a jQuery specific way to do it? Thanks ...

IHTMLTxtRange, TextRanges and knowing if the text is visible or not

In a winforms application, I am using the IHTMLTxtRange interface (in c#) created from the body element to wander through the text on a page and process each word i come across using the MoveStart and MoveEnd methods.This works fine. I then need to know if the text would actually be visible to the end user - this is where i then start g...

Is XPath much more efficient as compared to DOM and SAX?

I need to parse an xml string and find values of specific text nodes, attribute values etc. I'm doing this in javascript and was using the DOMParser class for the same. Later I was informed that DOM is takes up a lot of memory and SAX is a better option. Recently I found that XPath too provides a simple way to find nodes. But I'm not ...