Skip to content

Instantly share code, notes, and snippets.

@davidascher
Created December 2, 2011 01:32
Show Gist options
  • Save davidascher/1421253 to your computer and use it in GitHub Desktop.
Save davidascher/1421253 to your computer and use it in GitHub Desktop.
test("david exploring view selectors", function(){
var obj = $$({
model: {
},
view: {
format: '<div id="1" class="grandpa"><div id="2" class="other parent"><div id="3" class="child other andthen">test</div></div></div>',
},
controller: {},
myFunction: function(){}
}); // obj
$$.document.append(obj); // necessary for IE
validateObject( obj );
equals( obj.view.$('#2').html(), '<div id="3" class="child other andthen">test</div>', 'search by id');
equals( obj.view.$('.parent').html(), '<div id="3" class="child other andthen">test</div>', 'search by id');
equals( obj.view.$('#3').html(), 'test', 'search by ID with no subchild');
equals( obj.view.$('.child').html(), 'test', 'search by class with no subchild');
equals( obj.view.$().html(), '<div id="2" class="other parent"><div id="3" class="child other andthen">test</div></div>', 'return all children');
// is there a way to get the full outer node (starting w/ id=1)?
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment