Questions tagged [sizzle]

Sizzle is a JavaScript CSS selector engine.

Sizzle is a pure-JavaScript CSS selector engine. CSS 3 selectors are supported, plus an additional set of custom selectors.

Resources

165 questions
3
votes
2 answers

What is the difference between Sizzle and document.querySelectorAll

For what I know, Sizzle and querySelector/querySelectorAll are CSS selectors. So... What is the difference between loading Sizzle and doing: Sizzle("my CSS query") and document.querySelectorAll("my CSS query") Also, I am aware that Sizzle returns…
Angshu31
  • 1,172
  • 1
  • 8
  • 19
3
votes
1 answer

Reverse Zen Coding

I'm writing a JavaScript unit test suite and one of the features I'd like to add is the ability to assert that a certain element and its children match a given HTML structure. My first idea is to use jQuery (well, Sizzle) and ask that users write…
nickf
  • 537,072
  • 198
  • 649
  • 721
3
votes
2 answers

Multiple "not" conditions in prototype $$ CSS selector

I'm trying to exclude two cases in my CSS selector. Currently the selector looks like this: $$('select:not([class=session])').each(function(){ //blah blah }) But i want to exclude another class named "sessionproperties" Is there any way to…
Madison Williams
  • 350
  • 1
  • 4
  • 11
3
votes
1 answer

jquery find exception with contains selector

I have some code running with jQuery 1.7.2 I encountered an error when trying to find using this selector var x = "span:contains(\"C) Foo (Bar)\")"; $('body').find(x) https://jsfiddle.net/elewinso/dfbn82wo/7/ This issue is fixed in JQuery 1.8 and…
elewinso
  • 2,453
  • 5
  • 22
  • 27
3
votes
1 answer

Can a sizzle selector evaluate a regular expression?

I need to select links with a specific format of URLs. Can I use sizzle to evaluate a link's href attribute against a regular expression? For example, can I do something like this: var arrayOfLinks = Sizzle('a[HREF=[0-9]+$]'); to create an array…
KatieK
  • 13,586
  • 17
  • 76
  • 90
3
votes
1 answer

Using jQuery to select elements with data attributes assigns a null ID to its parent elements

This is truly bizarre. If I use jQuery's .find() to find child elements that have data attributes during a scroll event, then scrolling the page will repeatedly add and remove an ID to the parents of those elements. It's difficult to describe, but…
daGUY
  • 27,055
  • 29
  • 75
  • 119
3
votes
2 answers

Accessing Sizzle methods via jQuery

In the jQuery source it clearly says jQuery.find = Sizzle; but when i try to access a particular Sizzle method the function doesn't exist. This is what the objects look like. window.Sizzle | window.jQuery.find .isXML | …
TarranJones
  • 4,084
  • 2
  • 38
  • 55
3
votes
1 answer

JSoup selector select from right-to-left or left-to-right?

Does JSoup selector select elements from right-to-left or left-to-right? Take the 2 as example: #id .class1 and #id > .class1
coderz
  • 4,847
  • 11
  • 47
  • 70
3
votes
1 answer

Selecting an element with Id having colons in Sizzle/jQuery

I have an HTML which has some elements having ids with colons. For example,
Get my selector!!
This time with tag names I want to select these elements using jQuery. Here are my few…
Sachin Jain
  • 21,353
  • 33
  • 103
  • 168
3
votes
1 answer

Explain a block of crazy JS code inside Sizzle(the CSS selector engine)

So, here is the function for pre-filtering "CHILD": function(match){ if ( match[1] === "nth" ) { // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec( …
Andy Li
  • 5,894
  • 6
  • 37
  • 47
3
votes
4 answers

jQuery/Sizzle selector to find current element's parent?

Is there a way I can get the selected element's parent using only jQuery's/sizzle's CSS selectors? I need to be able to get an element's parent while using jQuery, but I'm unable use jQuery('#myelement').parent() since I'm receiving the selector as…
Phillip B Oldham
  • 18,807
  • 20
  • 94
  • 134
3
votes
2 answers

Adding Sizzle js to my project breaks the project

I'm not entirely sure what's happening here. I have my code that exists like: var mycode = { init:function(){ //my code here } } //sizzle pasted here... (function(){ //sizzle code here })(); Where "sizzle code here" is the…
Geuis
  • 41,122
  • 56
  • 157
  • 219
3
votes
1 answer

Inverse of Next Siblings Selector

So I came across the Next Sibling Selector on the jQuery docs today: $("label + input") And was wondering - is there an inverse of this selector? i.e. select the Previous Sibling? I could use: $("label + input").prev() For example in this fiddle,…
CodingIntrigue
  • 75,930
  • 30
  • 170
  • 176
3
votes
1 answer

Does sizzle support namespace in selector?

Who can tell me does sizzle support namespace in selector? If it supports, who can give me some examples, I can't find such information in API docs. Thanks!
user2155362
  • 1,657
  • 5
  • 18
  • 30
3
votes
2 answers

What's the meaning about the parameter seed

I'm reading Sizzle source code. I saw the definition below function Sizzle(selector, context, results, seed) My question is what's the meaning about the parameter seed? I can't find it in API document Thanks addendum The seed parameter is used in…
user2155362
  • 1,657
  • 5
  • 18
  • 30