FAQ Database Discussion Community


Array.prototype.splice.call - not working with a querySelectorAll('.className')

javascript,html,css,arrays,queryselectorall
I have three divs with a class name of .column , on the bottom, before my body tag I have a small script which is supposed to get these divs and put them into an array so that I can work on them. I've done this before so I don't...

Invalid selector with querySelectorAll :not with descendants

javascript,css-selectors,queryselectorall
I've got a case where I need to select different groups of nodes on a page, and I need to exclude certain child elements. My most common task is selecting all <img> elements, but not some that are descendants of certain elements. Take for example my fiddle here: http://jsfiddle.net/rjdbys13/ I...

Javascript querySelectorAll, how to match with only top elements?

javascript,jquery,html,polymer,queryselectorall
I am using polymer. Let say I have something in Template as follows <ul> <li> Home </li> <li> About </li> <li> Actions <ul> <li> Logout </li> </ul> </li> </ul> In Ready function var listNodes = this.querySelectorAll('ul > li'); I need help with this javascript query selector. The current query I...

Element-relative CSS selectors

javascript,jquery,css-selectors,queryselectorall
Is there a way to shorten these types of lines by using CSS selectors and jQuery? $(element).parent('tr').parent('tbody').parent('table') $(element).children('tbody').children('tr').children('td') It is basically: "get me the direct parent/children if any" I need 100% equal selectors. UPDATE: closest('table) does not work: can return the element itself AND may find not direct parents find('td')...

for of loop querySelectorAll

javascript,google-chrome,for-loop,mozilla,queryselectorall
Mozilla states that "for of loops will loop over NodeList objects correctly". (source: https://developer.mozilla.org/en-US/docs/Web/API/NodeList) However, this doesn't work in Chrome 43. Is this incorrect documentation or a browser bug? The copied example code used on a page with checkboxes: var list = document.querySelectorAll( 'input[type=checkbox]' ); for (var item of list)...

Is it possible to make querySelectorAll live like getElementsByTagName?

javascript,dom,css-selectors,getelementsbytagname,queryselectorall
getElementsByTagName() has 2 great features: it is fast and it is live. But what if I want to get p strong. Of course I could refine a selection using getElementsByTagName() again but wouldn't I loose the live effect for the new p tags? Is there a way to turn querySelectorAll...

How to select the