Skip to content
This repository has been archived by the owner on Sep 6, 2020. It is now read-only.

ruddzw/hassle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

A learning implementation of a CSS selector engine. It will work in Firefox 3 and Safari so far, not sure about anything else.

Just call:
hassle("selector")
and you'll get back an array of matching elements!
You can also call hassle(element) to get an array containing that element, or hassle("selector", element) to only find elements in that element's subtree

Current selectors supported:
===Basics======
#id
	Matches a single element with the given id attribute
element
	Matches all elements with the given name
.class
	Matches all elements with the given class
.class1.class2
	Matches all elements with all the given classes
*
	Matches all elements
selector1, selector2, selectorN
	Matches the combined results of all the specified selectors

===Hierarchy======
ancestor descendant
	Matches all descendant elements specified by "descendant" of elements specified by "ancestor"
parent > child
	Matches all child elements specified by "child" of elements specified by "parent"

===Attribute Filters======
[attribute]
	Matches elements that have the specified attribute
[attribute=value]
	Matches elements that have the specified attribute with a certain value
[attribute!=value]
	Matches elements that either don't have the specified attribute or do have the specified attribute but not with a certain value
[attribute^=value]
	Matches elements that have the specified attribute and it starts with a certain value
[attribute$=value]
	Matches elements that have the specified attribute and it ends with a certain value
[attribute*=value]
	Matches elements that have the specified attribute and it contains a certain value
[attributeFilter1][attributeFilter2][attributeFilterN]
	Matches elements that match all of the specified attribute filters

About

A CSS selector engine with no guarantee of high-performance

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published