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
0
votes
4 answers

JavaScript Methods on jQuery Selectors

How do I access the core HTML DOM element from a JQuery Selector? For example, the following code: $(document.body).appendChild(x); will not work because the DOM object that $(document.body) is referring to is wrapped around by a JQuery Selector…
Arjun
  • 1,261
  • 1
  • 11
  • 26
0
votes
2 answers

JavaScript - Having trouble with a click event

I am using sizzle to select various parts of the DOM. My code is below. The problem is that the onmouseup event is being triggered when the page is loaded instead of when the user interacts with the page. Can someone explain why this is…
ComputerUser
  • 4,828
  • 15
  • 58
  • 71
0
votes
2 answers

Including a minified js code in another js library

I want to incorporate a minified javascript library (for example http://sizzlejs.com/) into my own non minified javascript library. The reason is that my library plugs into other websites and I don't want to ask them to include the extra library…
Nir
  • 24,619
  • 25
  • 81
  • 117
0
votes
2 answers

Multiple versions of jQuery

I am working on service which allows third parties to upload HTML snippets. In some of these snippets there may be links to jQuery, SizzleJS... libraries and JavaScript code that requires specific versions of these libraries. The service obviously…
Adrien Hingert
  • 1,416
  • 5
  • 26
  • 51
0
votes
2 answers

Sizzle text equals

With the Sizzle selector engine, is it possible to find buttons with the exact text? For example, button:contains('Remove Document') will match any buttons that have the text "Remove Document" but I need it to not match buttons that say "Don't…
mpen
  • 272,448
  • 266
  • 850
  • 1,236
0
votes
1 answer

Why return !!var JavaScript?

After looking at Sizzle.js I noticed they have an assert function (see below) which returns !!fn(x). Why would anyone do that? It seems pointless to do that as it would just be "not not". function assert( fn ) { var div =…
DarkMantis
  • 1,510
  • 5
  • 19
  • 40
0
votes
1 answer

jQuery Sizzle call an error on selectors

Why below code call error when i use sizzle: var $myInput="#myForm input"; $($myInput+":checked").click(function(){ .... }); the $($myInput+":checked") selector return "[object Object] :checked". But when I simply use the variable content like…
mhdrad
  • 330
  • 3
  • 15
0
votes
1 answer

Select element A or element B with CSS selector

Is there a way to select either one of the 2 elements specified in CSS selector expression? If element A is not found then select element B. Example: css=input[id$=sometext]@id OR textarea[id$=sometext]@id The above expression should return id of…
finspin
  • 4,021
  • 6
  • 38
  • 66
0
votes
2 answers

Multiple CSS Selectors with Prototype

I'm refactoring some code that currently looks like this: $$('#wrapper > div').each(function(e){ if((e.id!='header') && (e.id!='footer') && (e.id!='content')){ // various other stuff here } }); I want to switch the initial selector…
robjmills
  • 18,438
  • 15
  • 77
  • 121
0
votes
1 answer

Using Sizzle to parse XML files?

I created a library for parsing and extracting information from a set of XML files that uses jQuery. So it's pretty simple to do things like this: $xml = $($.parseXML(xmlText)) title = $xml.find(".title>longName").text() I then realized that my…
Sam Fen
  • 5,074
  • 5
  • 30
  • 56
0
votes
2 answers

jQuery/Sizzle to select Text nodes only (or, how to transform XPath expression to Sizzle)

I have the following XPath expression to get all textNodes within a element. var textnodes = document.evaluate('descendant::text()', element, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null); Which works flawlessly across Chrome and Firefox, but…
tomsseisums
  • 13,168
  • 19
  • 83
  • 145
-1
votes
1 answer

Rails 4 - Sizzle returning Uncaught Error: Syntax error, unrecognized expression: [path_name]

Currently working on a Rails 4 project where we have the users log and sign in through modals. When I click on the link to open the modal, I get an error like this: As an example: This is the js code used to launch the modal if($('.modal').length >…
Jay M
  • 259
  • 3
  • 15
-1
votes
2 answers

How do I insert array values into a jQuery statement: $(arrayValue).css('width');

Here is my code: var iconArray = ["icon01", "icon02"]; var iconWidth = $("'." + iconArray[0] + "'").css('width'); When I try this code, I get the error message: Error: Syntax error, unrecognized expression: '.icon01' @ jquery-v1-10-0.js:1916 This…
Jason
  • 11
  • 5
-1
votes
1 answer

Sizzle and/or querySelectorAll - order of enumeration for nested elements?

If I have a nested set of DOM elements, e.g. ul > li > ul > li and I use the selector li by itself, do either Sizzle or document.querySelectorAll define the order in which the elements will be returned? Orderings that might be returned include "top…
Alnitak
  • 334,560
  • 70
  • 407
  • 495
-3
votes
4 answers

How do I retrieve the nth item returned by a jquery class selector?

If I pick out a class with a jquery selector, like this: $(".listHeading") and it returns m elements from the DOM, how do I pick out the nth of the m elements via a selector? I found this post, but it is not quite right because it says to call .eq()…
bernie2436
  • 22,841
  • 49
  • 151
  • 244
1 2 3
10
11