The Document Object Model (DOM) is an application programming interface (API) for valid HTML and well-formed XML documents. It defines the logical structure of documents and the way a document is accessed and manipulated.

learn more… | top users | synonyms

6
votes
1answer
71 views

Generating DOM from a complex strings via arrays

This is a revised and expanded version of Transforming complex strings into simple arrays My function grabPerson turns strings of user information from multiple ...
3
votes
2answers
54 views

Performance of a method to mask all but one rectangular element on the page

The point of this code is to mask a page where the user is editing the page's 'body' content. This is in a CMS. The rest of the page is the website template (i.e. header, index bar etc...). I've ...
1
vote
0answers
30 views

Validate XML using XSD, a Catalog Resolver, and JAXP DOM for XSLT

Background As this related question describes, there does not appear to be a canonical way to validate XML files against an XSD then subsequently transform them using an XSL template with file paths ...
6
votes
1answer
69 views

Tiny DOM builder

My goal was to create a tiny DOM builder library that made creating element trees less gross. This is the syntax I decided on: ...
1
vote
1answer
49 views

Assignment Chaining

In the following code, I've just parsed an JSON object called responseObject from an AJAX call, one of whose members is an array of objects called ...
5
votes
1answer
271 views

Manipulate HTML document loaded into WebBrowser control

I have developed my custom solution for this. It happened that the first solution is using XPath queries and the second, a conceptually similar to the first one, is using CSS queries processed by ...
3
votes
1answer
44 views

Recognizing elements and doing event handling for repeating templates

This fiddle has an ADD button when you click it a Chat window is added. When there are more than 1 windows the message from one window is reflected across all the windows. Say you have templates (in ...
2
votes
2answers
73 views

List of search results using Selenium

I have written the following code for looping through WebElements in Selenium. Can someone please provide me with feedback on how to improve my code? ...
3
votes
2answers
52 views

DOM building using DocumentFragment

I want to build the markup below by iterating on an array of objects. The structure of the object is also listed below. I need some tips on how to make it clean. Markup I want to build: ...
2
votes
1answer
43 views

b10k minigame problems

I tried to recreate a mini game (not sure about its name, I call it b10k) with 2048 looks, therefore it looked better if I use html elements, and I really am not good at working with them, but I ...
1
vote
0answers
32 views

Optimizing jQuery table building by replacing appends with string concat

I've wrote some code to create a grid of data, however depending on the size of the grid being drawn, IE8 shows a warning message about a long running script. I've read that multiple appends are a ...
3
votes
2answers
42 views

HTML/Attrs Tester Environment

I have a few objectives (which are working fine, but I want tips in case I can improve it). Let me try to make this as clear as possible, as this is a much larger project: There are three move ...
4
votes
2answers
67 views

Accessible tabbed UI

I've started working on a script that turns sections with headings into a tabbed interface. The repo is at https://github.com/derekjohnson/tabs and a demo at http://derekjohnson.github.io/tabs/ It ...
4
votes
3answers
74 views

New Game - Am I going down the right path for DOM manipulation?

I find myself using a lot of .find functions within what I'm developing. The reason being that I need to run this same function on a TON of different characters ...
4
votes
1answer
79 views

Triggers placing and sizing elements for video controls

I have some triggers placing and sizing elements for video controls. It works well enough but mostly through trial and error and I am not sure if there is a better pattern: The full source can be ...
2
votes
1answer
456 views

How to do a small calculation on a drop down when clicked?

I have a form that requires a calculation when clicked on a multiple drop down selector, and still displays the clicks of the courses in real time and lastly calculates the sum total of the courses. ...
6
votes
1answer
222 views

Interactive slider

Task: Create an interactive slider that allows the user to view a given image gallery. Slider controls: See previous slide See next slide Quick navigation through the images / Paging - ...
5
votes
1answer
103 views

Optimise JavaScript DOM update

I'm building a virtualised grid in JS/HTML and finding browser performance with large grids fairly slow, particularly in IE10/11. The following jsfiddle roughly represents my worst case scenario, ...
4
votes
1answer
118 views

Fix base64 data URI scripts function

So I noticed Chrome has quirky behaviour when it encounters script tags whose src is a base64 value. I decided to write a quick ...
4
votes
2answers
403 views

forEach and NodeList

This is loosely based on one of W3_School samples: ...
3
votes
2answers
83 views

Horizontal menu for 3 items

My task was to create a menu that displays three items (A,B,C), and has two nav buttons <- and ...
0
votes
3answers
145 views

Image Carousel in JavaScript

I created a very basic "image projector" that shows the current one and shows the next on clicking into the image. And yeah, it works, but I don't think that's a very elegant way to do it. Any advice ...
2
votes
2answers
118 views

Showing/hiding a box containing a Facebook profile

I see that there are quite some words that are appearing double or more times in my code. I'm thinking there might be a more efficient way of writing this code, only I don't have the knowledge to do ...
10
votes
3answers
199 views

Updating Grid on Webpage (new version)

Previous version: Updating Grid on Webpage Task: Draw a grid with a given number of rows and columns. Each cell can be any color. The same grid should also be updated at a predetermined time ...
5
votes
2answers
130 views

Updating Grid on Webpage

Task: Draw a grid with a given number of rows and columns. Each cell can be any color. The same grid should also be updated at a predetermined time interval. The grid should cover the ...
1
vote
1answer
97 views

JavaScript Sticky Footer

I'm using this JS to sticky website footers at the bottom and I would like to know if is there anything to be optimised? ...
3
votes
1answer
116 views

Best practice to create XML messages with DOMDocument class in PHP

I want to create XML messages for webservice communication. These messages should be created from a pool of reusable elements. Therefore I have created different classes. A "factory" class, that only ...
6
votes
1answer
513 views

MutationObserver (shim): Finding differences between 2 DOM trees

I've been working on a MutationObserver es5 shim and would appreciate some feedback on my technique for identifying changes between a ...
8
votes
2answers
162 views

JavaScript Game Engine Design

I recently gutted and redid my game code to be object oriented (before it was just functions and a mass of global variables. Before I go an make more functionality happen, I would like to take one ...
1
vote
0answers
61 views

DOMDocument grouping nodes, with clone, nodeClone, importNode, fragment… What the better way?

A "DOMNodeList grouper" (groupList() function below) is a function that envelopes a set of nodes into a tag. Example: INPUT ...
2
votes
2answers
196 views

DOM parser implemented from scratch

I have implemented a DOM parser. I would like any comments for optimizing, improving, and making the code coherent to best coding practices. ...
1
vote
1answer
142 views

WebGL ( Three.js ) simple application ( only js without html/css )

I have done the source code for my lesson, which I shall publish later in web at my website, let's look at it: ...
0
votes
3answers
173 views

Creating chunks of HTML with jQuery

I am working on an online ordering form and am looking for some advice about my jQuery. I am re-developing the code base for this ordering form and improving what was created by a web design group ...
1
vote
1answer
32 views

CSS Styling: Should I specify the element type?

Which of the following is better code: div#style1{ } or #style1{ } Also, should the element type be specified for ...
2
votes
1answer
282 views

Javascript DOM Override Review

I'm building an mini-app that will display when changes to the DOM have been made by javascript. I have all of the functions that I can think of listed in the code. Is there a way to consolidate the ...
3
votes
1answer
1k views

Proper way of using IXMLDOMDocument

I am trying to use IXMLDOMDocument for XML reading/writing. I am not good COM, and I am not aware that I am doing things right or wrong. I am very unsure that there could be some problems with COM ...
3
votes
1answer
442 views

Custom event to match CSS :target pseudo-class

The following code makes jQuery trigger a new target event on elements when they become the target of the fragment identifier. For a very basic example, the ...
3
votes
1answer
309 views

First attempt at MVC JavaScript pattern

I would really appreciate a review of my interpretation of MVC here. It's as bare bones and clear as possible. I've based it on some in-depth reading but I don't know if I have understood everything ...
0
votes
1answer
82 views

Is this code likely to stand the test of time? (Add select box to DOM with JS)

The reason I asked about standing the test of time is that I previously used PHP echo to create a string and placed it into a div with .innerHTML, but modern browsers were not passing the value of the ...
4
votes
4answers
404 views

My first javascript sorting

I started learning JavaScript a week ago, and I made a sorting function on my own. It does work, but I need reviews and how to write a better one. ...
5
votes
3answers
667 views

Implementing an algorithm that walks the DOM without recursion

Here's a simple algorithm that walks the DOM given a node: ...
3
votes
1answer
105 views

Javascript Form Manipulator Code Review

I'd appreciate a review of at least some of this javascript, if anyone has time. It's really long, but I think it's useful. It's designed to let you create forms and do javascripty things by only ...
2
votes
1answer
2k views

Optimize Recursive Function to traverse nested DOM nodes

I wrote a recursive function that traverses nested DOM nodes of the following form: ...
3
votes
1answer
199 views

eDomForm - dynamic forms without writing any JavaScript

I'd like some comments and any suggestions that you have for where to go next with this. I've been working on developing a JavaScript library that allows for dynamic forms by simply adding some extra ...
3
votes
1answer
133 views

String processing in JavaScript

We have a lot of phone numbers that contain dashes and start with a zero which are from another country. I am trying to strip the dashes and the one leading zero and select the country code from a ...
5
votes
2answers
134 views

OOP approach to using DOMDocument

I've tried to write an "OOP" approach to printing a website using the DOMDocument class. I'm kind of stuck here because I feel like I am blundering in how I am passing and using the DOMDocument. I ...
1
vote
1answer
163 views

Better way to hide, change and show DIVs in Javascript

I made this Javascript to hide, show and change some DIVs but I believe it's not really good code. Can you help me to make it better? ...
1
vote
1answer
71 views

when we need to add some javascript code to html, where we have to put it?

when we need to add some javascript code to html, where we have to put it? What is the best practice: in line: ...
7
votes
1answer
299 views

Very fast query selector — did I miss something?

A few months ago, I wrote a query selector that seems to outperform the query selectors in the popular GP libraries by a pretty hefty margin. I'm wondering if I overlooked something; it seems odd that ...