I have a page (w/ multiple tags of course) and there’s a class that affect only 1 of those tags; is it more efficient (for the running system) to apply the instruction set (including S&R) to only the tag which may be affected or (faster) to all tags?
If you’re wondering which CSS declaration is more efficient, that’s of much less importance than communicating whether the fancy button style is intended for the general purpose or exclusively only to tab1.
Can you please clarify what you mean by tag, and provide further information about two different types of situations that you are wanting to compare the performance?
<p class="js_disabled"><a href="#">Toggle background color</a></p>
<p>Lorem ipsum <span class="classA">dolor</a> sit amet, consectetur adipiscing elit. Nam rutrum, lacus ut fringilla dapibus, velit ante <span class="classA">placerat</a> ipsum, ut convallis ligula lectus at dolor.</p>
<p>Nulla facilisis, ex eget eleifend sodales, ipsum <span class="classA">lectus</a> interdum augue, vel eleifend <span class="classA">nisl</a> dui vel felis. Pellentesque fringilla, dolor eu iaculis hendrerit, ipsum turpis eleifend nisi, sit amet porttitor sem nulla in nunc.</p>
I’m quite the beginner in ECMAscript so I’ll do some pseudo-code of sort:
onload page
snrClass(js_disabled, js_enabled) // snr for S&R
// Uncomment only 1 of the following 2 blockquotes.
/*
allTags = getAllTags()
forEach tag in allTags
snrClass(tag, classA, classB)
*/
/*
tagsSpan = findTags(span)
forEach tag in tagsSpan
snrClass(tag, classA, classB)
*/
Which of the 2 blockquotes is more efficient (for the system) ?
Update 1: The 1st blockquote is essentially the same as the 1st instruction, with different classes to S&R.
The second one is more efficient as it allows opportunity for performance improvements in findTags().
It’s more efficient to work with a smaller set of results than a larger set.
Well I asked on irc://freenode/#JavaScript and a couple people agree w/ you. I asked there 1st before asking here, perhaps there was no1 active (actually looking at the chat) at the time. I was going to PM you the quote (which by default IRC content is private but every1 is welcomed) but I can’t seem to PM you at all.
[quote=“dynvec, post:8, topic:294578, full:true”]I was going to PM you the quote (which by default IRC content is private but every1 is welcomed) but I can’t seem to PM you at all.
[/quote]
New members have limited access to such features until sometime later.
As Paul says, new members have some restrictions. These will be lifted when you reach Trust Level 1, which isn’t hard to do. An Explanation of Trust Levels