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

4
votes
0answers
32 views

Periodic Table generator

I've been playing around with Jekyll and CoffeeScript the last few days and made a Periodic Table to learn those two. Now, to create the Periodic Table, I take an array of ...
0
votes
1answer
58 views

Recursive functions

I am using the following code which recursively executes function findWpisInZone(), code works fine, I just wondering if there is any better way to do it in JS, ...
1
vote
1answer
34 views

Adding classes with JavaScript

I am working again and got this to work. Is this the best way to write this code? ...
1
vote
0answers
35 views

PHP DOM XML Creation

I am currently working on Shopify webhooks which posts XML to the Colorado timber line API. But due to the order protocol of the Colorado timber line API, it is required to modify the XML posted by ...
1
vote
1answer
84 views

Displaying data from JSON in a table

What do you think of my code? I know it is a little rough around the edges but as of two days ago I had no idea how to use jQuery or JavaScript. ...
2
votes
1answer
48 views

Using TAGS with <script> on your websites

This function creates a series of links at a desired destination by the usage of a premade tag system. Usage: createMyTAGS_DATA passes in a single line of all ...
2
votes
1answer
32 views

JavaScript library for cookie information

I've always struggled to write JavaScript code that I thought of as great and "correct" code. And I've struggled to find good information on how to do it. Recently I was given a task at work to write ...
5
votes
2answers
63 views

Equal heights in pure JS

I'm pushing myself to learn pure JavaScript, so this morning I wrote an equal heights script in jQuery and then converted it to JavaScript. It works, but I'm using two ...
4
votes
1answer
83 views

Get all the attributes of a DOM Node

I needed this small function for one of my project. Fetch Attributes ...
4
votes
2answers
137 views

Get <TH> texts into a tab separated string

table_with_headers = $(this.dom.table).find("thead tr th").map(-> $(this).text() ).get().join("\t") Can one write it nicer? I especially dont like the inner ...
6
votes
1answer
78 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
69 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 ...
3
votes
1answer
152 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
92 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
53 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
3k 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
61 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
111 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
89 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
49 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
52 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
43 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
72 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
77 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 ...
3
votes
3answers
185 views

Correct use of appendChild

I want to be able to append a value to the bottom of a list and I set a node to create and element of <li> and then set the text document node to my value. ...
4
votes
1answer
86 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
943 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
319 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
118 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
164 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
555 views

forEach and NodeList

This is loosely based on one of W3_School samples: ...
3
votes
2answers
86 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
172 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
134 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 ...
11
votes
3answers
203 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
134 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
142 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
159 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
606 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
170 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
68 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
234 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. ...
3
votes
1answer
178 views

WebGL (Three.js) simple application

I have done the source code for my lesson, which I shall publish later on my website: ...
0
votes
3answers
205 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
328 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
2k 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
512 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
351 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 ...