javascript - PrototypeJS: Selecting visible elements -
I am trying to create a selector to select a group of visual elements. Our application uses Prototype Javascript Framework, version 1.6.0.3.
The markup I am working with is as follows:
& lt; Ul & gt; & Lt; Li style = "display: none;" & Gt; 1 hidden & lt; / Li & gt; & Lt; Li style = "display: none;" & Gt; 2 hidden & lt; / Li & gt; & Lt; Li style = "" & gt; 3 visible & lt; / Li & gt; & Lt; Li style = "display: none;" & Gt; 4 hidden & lt; / Li & gt; & Lt; Li style = "display: none;" & Gt; 5 hidden & lt; / Li & gt; & Lt; Li style = "display: none;" & Gt; 6 hidden & lt; / Li & gt; & Lt; Li & gt; 7 visible & lt; / Li & gt; & Lt; Li style = "" & gt; 8 visible & lt; / Li & gt; & Lt; / Ul & gt; As you can see, some elements can be , have a style feature, but only hidden people have the string "Display: None"; Send me the & lt; Li & gt; Elements need to be seen, where visibility is defined, "not displayed: none".
What I tried to overcome:
var visible = $$ ('li * style * = "display: none'] '); // Yield: [] var visibleItems = $$ ('li [style * = "display"]') / / yield: [li, li, li, li, li] but is not specific enough Thoughts? Ideally I want to be compact as possible, but whatever I can get will be taken.
Yes, I know that but I Do not want to present another outline in the application Because much is already dependent on prototype.
You can filter items by using the function Can:
var notVisible = $$ ('li'). All (function (L) {return! El.visible ();});
Comments
Post a Comment