dom

How should I verify the page DOM when attaching jQuery/javascript events to elements?

I'm using jQuery to add events to DOM elements. As I do this, I often times use selectors that technically could gather a list of matching items rather than just a single one. e.g. using the .children() and .find() methods I could find 0, 1 or many matching DOM elements. Do I simply need to check .size() == 1 on every element as I att...

PHP Simple HTML Dom Memory Issue

I'm running into memory issues with PHP Simple HTML DOM Parser. I'm parsing a fair sized doc and need to run down the DOM tree... 1)I'm starting with the whole file: $html = file_get_html($file); 2)then parsing out my table: $table = $html->find('table.big'); 3)then parsing out my rows: $rows = $table[0]->find('tr'); What I'm...

Is there a way to create your own HTML element?

Is there a way to create your own HTML element? I want to make a specially designed check box. I imagine such a thing would be done in JavaScript. Something akin to document.createHTMLElement but the ability to design your own element (and tag). ...

After the DOM is ready, IE will not show page content when Javascript is modifying the DOM? (but Firefox will show)

I have a page that will initialize jCarousel when the DOM is ready (by jQuery's $(document).ready()), but on IE 8, the page is not displayed until jCarousel has finished initializing, which can be 1 minute later. On Firefox and Chrome, the page content is shown right away, while letting jCarousel do its job. So is it true that IE will...

org.xml.sax.SAXParseException: Reference is not allowed in prolog

Hi, I am trying to escape html characters of a string and use this string to build a DOM XML using parseXml method shown below. Next, I am trying to insert this DOM document into database. But, when I do that I am getting the following error: org.xml.sax.SAXParseException: Reference is not allowed in prolog. I have three questions: 1...

I have a couple thousand javascript objects which I need to display and scroll through. What are my options?

I'm working off of designs which show a scrollable box containing a list of a user's "contacts". Users may have up to 10,000 contacts. For now assume that all contacts are already in memory, and I'm simply trying to draw them. If you want to comment on the question of how wise it is to load 10k items of data in a browser, please do it...

How to attach an event to a button in an iframe

Right now I have a jQuery UI dialog with an <iframe> inside of the dialog. When the user pushes a button, the dialog pops up with a form-editing screen in the iframe. Well, I want to have two buttons in the inner form-editing screen, "cancel" and "ok". Cancel doesn't save changes and closes the dialog, ok saves changes and closes the d...

Bulletproofing SimpleXMLElement

Everyone knows that we should always use DOM techniques instead of regexes to extract content from HTML, but I get the feeling that I can never trust the SimpleXML extension or similar ones. I'm coding a OpenID implementation right now, and I tried using SimpleXML to do the HTML discovery - but my very first test (with alixaxel.myopenid...

Check if each cell in a table is equal to the cell above.

How do you check in JS what the value of the td above the current one is in a table? I'm trying to get a table like this: |column1 | column2 | column3 | column4 | ---------------------------------------- | | | | | ---------------------------------------- | | | data | | ----------...

Can't call getElementsByTagName on a node in Xerces or Neko?

hi all I'm trying to parse a DOM tree using Neko/Xerces in Java. NodeList divs = this.doc.getElementsByTagName("DIV"); for(int i=0; i < divs.getLength(); i++) { NodeList images = divs.item(i).parentNode().getElementsByTagName("IMG"); // operate on these } is what I'd ideally like to do. It seems I can only call getElementsByT...

Any clever ways to serialize an HTML element? - Javascript

Hi folks, I'm trying to store a reference of an HTML tag for later reuse. e.g. If I click on a div and save a pointer to that div within Javascript, will there be a way I could serialize such pointer? So I could de-serialize it and use the pointer in another instance of the web application? Only methods I can think of are the follow...

How can I select elements living in a certain range of the DOM hierarchy?

I have a DOM element C which is a descendant of DOM element A. There are several layers between them, one of which is an class of element named B. If I have jQuery("#A") and jQuery("#C), how can I find the parent element of C with class B, which is also a descendant of A? If I use parents() of C then I could potentially get any elemen...

Info on DOM and web page lifecycle

I'm trying to find some good info on the ordering and events of a page...fundamentals. (ordering of what loads and when ...DOM, javascript, no matter what language you're coding in) Does anyone know a good reference I could take a look at? I haven't found any good articles except for ASP.NET but I'm not looking for that specifically....

Why are some jQuery UI operations unsuccessful on disembodied DOM elements?

I tried creating a disembodied DOM element with jQuery (I avoid ever touching the DOM directly w/o going through jQuery, so I do treat their wrapped sets and the DOM elements underneath somewhat equivalently) and applying .tabs() to it, and only later adding the element into the DOM. The tabs kind of worked and kind of didn't. It seemed ...

fire javascript event on object creation

Is there any way to fire an event when an object of a certain type is created? I have an <div> element with editableContent="true" and when the user presses enter within the <div>, a new <div> is created that takes up just that line. Is it possible to have an event fire whenever a <div> object is created within my original <div> object?...

Jquery fade in / out looping more than once

I've been using jquery to do some image swapping and fading. I have a div, with and id of cup-builder-error I use jquery to load images into divs, then on error fade in and out the error div $("#imgShell").attr("src","products/components/" + idArray[2] + ".png").error( function(){ ...

Is it possible to submit JavaScript array along with form submission?

I would like to create a list-like form for a web application. Elements are added to, modified and removed from the list, and the user clicks "Submit" to send the list to the web application for further processing. I would like to have two INPUT fields that I can add data into, click an "Add" button, and the data is added to both the DO...

the link to the latest DOM specification

I read the latest DOM specification, which is under draft, that the new DOM model provides APIs for checking dynamically added event handlers. I couldn't find the link to that site and didn't find it using google. Does anyone has the link? ...

How do you translate IDL into C#?

For example, the DOM specification has various IDL definitions, one of which is the Interface Node. How would you go about translating thiseven a portion of thisinto actual C#? I mean, where would you even start? As far as I understand, C#'s interfaces behave much differently than what IDL is calling an interface here. Am I wrong? inter...

PHP Increase Indentation of DOMDocument->saveXML ?

Hey, I need to increase indentation of a formatted xml file to 4 spaces from 2 I tried using a regex powered XML formatter but it forgot to indent closing tags that were on a new line. What options do I have, using preg_replace seems the best option, the search regex would be something like /( {2}^ANYTHING_EXCEPT_SPACE)/ but that's as...