$('*').mark matches within a url in the <noscript> section
See original GitHub issueBug or feature? I’m new to this, but I was hoping that I could use $('*').mark("firefox")
to mark all visible instances of “firefox” on the page. But I also found <mark> tags in a url in the <noscript>
part of the page like:
<noscript><meta content="0;url=/search?q=<mark data-markjs="true">firefox</mark>&client=<mark data-markjs="true">firefox</mark>-b&gbv=1&sei=taFDW8vrBYL4kwWx9bLIDA" http-equiv="refresh"><style>table,div,span,p{display:none}</style><div style="display:block"><a href="/search?q=<mark data-markjs="true">firefox</mark>&client=<mark data-markjs="true">firefox</mark>-b&gbv=1&sei=taFDW8vrBYL4kwWx9bLIDA">Klicke hier</a>, wenn du nach einigen Sekunden nicht automatisch weitergeleitet wirst.</div></noscript>
which looks like a bug because tag in tag is syntactically wrong, but maybe $(‘*’) is to broad for mark.js? Anyway, it is in my way because I want to scroll the page to the first <mark>
element, and that apparently gets stuck at the invisible <noscript>
section at the very top with <mark>
tags in it.
Steps to reproduce
See the next section. I can give more details if this really is a bug and not a feature. With my add-on installed, it would be: Search “firefox” in Google. Invoke mark.js by clicking the newly created bookmarklet “firefox” and search for “mark” with the web developers inspector tool.
Environment
- Programming a web extension https://addons.mozilla.org/en-US/firefox/addon/findonpage-bookmarklets/
- Firefox Quantum 61.0 (64-bit)
- jquery.mark.js v8.11.1 (with jquery 3.3.1)
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
As it turns out, I actually did read the contribution guidelines before submitting, and they say: fiddle “if possible” and nothing about “required” Otherwise I would not have had the time to submit the issue. Now, I would have set up the fiddle eventually along more friendly a communication - but this here is not worth it. I’m able to work around that issue without bothering you any more with my humble observations. So let’s just leave it closed.
@Mottie It should be the same for body, as even then existing
<mark>
tags will be included. However, this is a feature not a bug, to allow you to highlight multiple terms with different classes in the same context. Nevertheless, ignoring can be done with theexclude
option or thefilter
callback.The issue that @beccare has with
$('*')
is that he actually calls mark.js with thenoscript
tag as context. And mark.js wont filter the actual context, just the children of the context. So it’s a bug of the way @beccare is using mark.js.So, your solution is correct anyway 😃