selectors-api Questions

4

Solved

Say I have an array of DOM elements based on any selector var elems = document.querySelectorAll(selector); I have no idea what's included in elems, but let's assume that elems.length > 0 I'd...
Burrussburry asked 18/2, 2014 at 18:2

4

What I'm asking is how to implement the equivalent functionality of jQuery's children() with HTML5's querySelector/querySelectorAll, i.e. how do I designate the current element in the selector patt...
Plosion asked 28/10, 2013 at 5:18

2

I'm trying to do some web-scraping via PowerShell, as I've recently discovered it is possible to do so without too much trouble. A good starting point is to just fetch the HTML, use Get-Member, an...
Pleura asked 12/5, 2016 at 20:12

1

Solved

Reference answer: https://stackoverflow.com/a/38399344/5132413 Please refer my question and the answer linked above works only in Firefox, Chrome, and Opera. I did some research and found that it...
Hallucinatory asked 1/8, 2016 at 11:15

2

Solved

I have this code: <a href="javascript:alert('something1')">Click</a> <a href="javascript:prompt('something2')">Click</a> <a href="javascript:alert('something3')">Clic...
Dendy asked 15/7, 2016 at 14:48

2

Solved

The definitions from the DOM Standard seems almost exactly the same, and I don't understand the difference. What is the difference between queryAll and querySelectorAll. The evaluation logic from D...
Preternatural asked 24/4, 2014 at 13:4

5

Solved

I would like to know is querySelector supported by all browsers? is not what's alternate for it to use? I have tested it with IE8, FF3, Chrome 4. Its fine for me. I do not have old browsers. So i ...
Globulin asked 4/10, 2010 at 14:42

1

Solved

Let's say I want to find all div elements and span inside p. Is it possible to get all what I want in a single querySelectorAll invocation? Conceptually it should be something like document.querySe...
Higdon asked 11/4, 2016 at 9:35

1

Solved

Scenario I've got some text inputs and I want them to have a width of 500px when they're clicked. My code var inputs = document.querySelectorAll("input[type=text]") for(i=0; i<inputs.len...
Thessalonian asked 27/12, 2015 at 16:49

3

Solved

I haven't had any problems in FF or Chrome, but IE9 chucks an error on this method. I thought I would be able to use it, due to it having been shown to be supported here: http://www.quirksmode.org...

2

When using querySelectorAll, what is the correct way to check if it returned any elements? It returns something that can't be checked for false. This doesn't seem to work: var elements = document...
Dampen asked 17/9, 2015 at 18:53

2

Solved

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 lo...

1

Solved

I have a variable which is a node from the dom. I've managed to get all the way down to close to where I want to be: myvar.querySelector('.tblItinPriceSummary tr') Gives me this: <tr> &l...
Langdon asked 1/4, 2015 at 19:12

3

Solved

Say I have an HTML structure like <div id="a"> <div id="b"> <div id="c"></div> </div> </div> To do a query for the children of "a" using querySelectorAll I...
Pinion asked 11/7, 2012 at 20:14

1

Solved

Everyone knows what DOM selectors like document.getElementByID(...) and document.querySelector(...) do and how you can use it with classes, attributes, id and so on. But I was not able to fi...
Ionone asked 7/9, 2014 at 23:2

2

Solved

How could I test CSS1-3 selectors to check that they get the correct elements, e.g. with JavaScript (maybe jQuery)?
Mariellemariellen asked 6/2, 2012 at 19:17

3

Let's presume you got a list with nested child lists. <ul> <li></li> <li> <ul> <li></li> <li></li> </ul> </li> <li>&...
Araldo asked 17/4, 2012 at 10:58

2

Solved

For some reason when I try running the following code: var casper = require('casper').create(); var x = require('casper').selectXPath; var links = []; casper.start('http://www.website.com'); fu...
Southsouthwest asked 2/4, 2013 at 20:22

2

Solved

I have this piece of code: var requiredFields = el.querySelectorAll("input[required]:not(:disabled):not([readonly]):not([type=hidden])"); If I want to add the textarea and select to the query I'...
Chee asked 19/12, 2013 at 9:35

2

Solved

I am working with EPUB.JS, which uses the following code to get some information from an ePub file: var navEl = navHtml.querySelector('nav[*|type="toc"]') This line of code fails in IE10, as the...

2

Solved

Does querySelectorAll support the period(.) character in an id? I mean if I append an element like below: var div = document.createElement('div'); div.id='my.divid'; document.body.appendChild(div...
Oversexed asked 10/7, 2013 at 5:50

2

Solved

I tried to use document.querySelectorAll(), but IE8 throw error, that Object doesn't support this property or method var titleCheckBox = document.querySelectorAll(""); Here http://www.quirk...
Dom asked 4/6, 2013 at 14:24

1

With the code from this article I've successfully added querySelectorAll to document in IE7. But I need to use it on an element rather than document, like this: var containers = document.querySel...
Phonogram asked 10/5, 2013 at 8:47

1

Solved

document.querySelectorAll('a:visited') always returns empty NodeList, even if the DOM has some visited links. I have tried it in Chrome. Is there any know bug or is it expected behavior? While :v...

4

XPath can do everything querySelector can do, and more, so when would you ever choose the latter? I haven't seen any speed benchmarks comparing the two, so right now I'm choosing based on syntax co...

© 2022 - 2024 — McMap. All rights reserved.