Skip to content

Commit

Permalink
Fixes #991 - Adding the :root pseudo-selector
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiomcosta committed Sep 24, 2010
1 parent ba67ba2 commit 7aa6372
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
6 changes: 6 additions & 0 deletions SlickSpec/specs/slick_xml_specs.js
Expand Up @@ -26,6 +26,12 @@ var specsAssetsTemplateXML = function(context){
it_should_find(1, '#node[style=border]');
it_should_find(1, '[href^=http://]');

it_should_find(1 , ':root');
it_should_find(0 , 'html:root');
it_should_find(1 , 'HTML:root');
it_should_find(1 , 'camelCasedTag ! :root');
it_should_find(3 , ':root camelCasedTag');

});

};
15 changes: 11 additions & 4 deletions SlickSpec/specs/specs-mock_template.js
Expand Up @@ -53,7 +53,7 @@ var specsMockTemplate = function(context){
it_should_find(6, '.a1 ~ *');

/*
it["should count '.a1 ! *'"] = function(){
it("should count '.a1 ! *'", function(){
var result = {};
Expand Down Expand Up @@ -88,10 +88,10 @@ var specsMockTemplate = function(context){
dupe = false;
}
value_of( uniques.length ).should_be( 7 );
// value_of( dupes.length ).should_be( 0 );
expect( uniques.length ).toEqual( 7 );
// expect( dupes.length ).toEqual( 0 );
//
};
});
*/

it_should_find(6, '.a1 ! *');
Expand Down Expand Up @@ -285,6 +285,13 @@ var specsMockTemplate = function(context){
it_should_find(19, 'p:last-child');
it_should_find(54, 'p:first-child');

it_should_find(1 , ':root');
it_should_find(1 , 'html:root > head:first-child');
it_should_find(0 , 'body:root');
it_should_find(1 , 'a ! :root');
it_should_find(12 , ':root ul .tocline2');
it_should_find(0 , 'body :root');

// specs['":contains()" elements should actually contain the word'] = function(){
// var els = context.SELECT(context.document,':contains(selectors)');
// for (var i=0,el; el=els[i]; i++) value_of( el.innerHTML ).should_match( 'selectors' );
Expand Down
4 changes: 4 additions & 0 deletions Source/Slick.Finder.js
Expand Up @@ -651,6 +651,10 @@ var pseudos = {

'focus': function(node){
return !this.isXMLDocument && this.document.activeElement === node && (node.href || node.type || this.hasAttribute(node, 'tabindex'));
},

'root': function(node){
return (node === this.root);
}

/*</pseudo-selectors>*/
Expand Down

0 comments on commit 7aa6372

Please sign in to comment.