Questions tagged as 'dom'

2
answers

What's the difference between $ (document) .ready () and window.onload?

Is there a difference between $(document).ready() e window.onload plus one being JavaScript and the other being jQuery? I see that both events are triggered as soon as DOM Document Objects) is loaded. In practice as written:...
asked by 08.02.2017 / 13:17
3
answers

Why use getElementById if the id is in the window?

Recently in my study I noticed an object that manipulated the DOM of the element that had the same name in its id . teste.style.border = '1px solid #CCC'; teste.style.width = '500px'; teste.style.height = '50px'; <div id="teste">...
asked by 13.04.2016 / 14:23
3
answers

Why is it wrong / bad to repeat an HTML ID?

I think the title says it all, why is it wrong to repeat HTML IDs? I notice lots of people doing things like: <div id="foo">bar</div> <div id="foo">baz</div> To apply CSS and understand the problems that this caus...
asked by 27.07.2018 / 17:10
4
answers

Does the order of CSS styles influence the render tree?

During the paint of the document by the browser the order of the properties of the CSS classes can interfere in how we perceive the "assembly" of the page? Especially on slower connections, we literally see the styles being applied to the e...
asked by 03.09.2018 / 16:34
1
answer

Display many elements in the DOM can affect performance?

I really like using libraries as Vue and AngularJs and my favorite implementation was Infinite Scroll (or demand-driven loading). I mean, I initially load 15 records via ajax. If the user scrolls the page, loads another 15, and s...
asked by 13.08.2018 / 20:41
2
answers

How to clone an element in Javascript?

Is it possible to get an exact clone of a particular HTML element? so that the clone contains all the properties exactly the same? If there is one, I would like to know how to proceed with this clone, and also to understand how it is acting,...
asked by 05.02.2014 / 14:53
2
answers

document.getElementById ('ID'). func (...) vs ID.func (...) [duplicate]

Yesterday I came across a curious thing , I had no idea what to do in this way. So far I've done it this way: document.getElementById('a').innerHTML = 'CONTENT'; <div id="a"></div> Always but always I have seen t...
asked by 24.01.2017 / 12:32
1
answer

When is it useful to capture DOM events?

DOM events scroll through the document tree its target, with a capture phase and a bubbling phase. The default behavior when creating a listener with addEventListener is to treat the event in the bubbling phase. When is it useful to h...
asked by 15.06.2014 / 06:20
3
answers

How to verify undefined correctly in Javascript

What is the best way to check if an element / variable is undefined in Javascript? I have already seen some examples using variavel === undefined and others using typeof variavel == "undefined" .     
asked by 04.08.2015 / 23:26
2
answers

How to analyze malformed HTML syntactically?

As part of a procedure, I need to extract the contents of a table present on a page. I'm using cURL to get the raw HTML data and the Simple HTML DOM Parser to parse and render HTML. <?php // (...) require_once('simple_html_dom.php'); //...
asked by 29.01.2015 / 17:57