$('> img[src="folderopen.gif"]',$scope)
The above will fail,seems a bug of jQuery,is there a work around?
This issue is found here:
How to judge whether there is a specific child(.haschild('#test[att="test"]')) with jQuery?
EDiT
I’ve just verified this will also fail:
$scope.children( 'img[src="folderopen.gif"]');
Tested, and Works:
Demo Online: http://jsbin.com/uyuri3
— with —
— works with your original syntax too —
An Interesting Bug
We know that our
srcvalue isfoo.jpg, yet the following fails:So I was curious if jQuery’s interpretation of the
srcwould be equal to the string literal source I provided in the HTML:This makes the whole situation very strange. jQuery argues that the
srcvalue is NOT equal to "foo.jpg" when you pass it in as part of the selector, but it IS equal to the string literal when you compare from a call toattr().In the end,
$=is necessary to get jQuery to agree that "foo.jpg" is equal to "foo.jpg". This certainly is a bug, but not an insurmountable one.