question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

$('*').mark matches within a url in the <noscript> section

See original GitHub issue

Bug 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>&amp;client=<mark data-markjs="true">firefox</mark>-b&amp;gbv=1&amp;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>&amp;client=<mark data-markjs="true">firefox</mark>-b&amp;gbv=1&amp;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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
beccarecommented, Jul 10, 2018

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.

0reactions
julmotcommented, Jul 11, 2018

@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 the exclude option or the filter callback.

The issue that @beccare has with $('*') is that he actually calls mark.js with the noscript 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 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Noscript element - HTML: HyperText Markup Language
The HTML element defines a section of HTML to be inserted if a script type on the page is unsupported or if scripting...
Read more >
HTML noscript tag
The <noscript> tag defines an alternate content for users that have disabled scripts in their browser or have a browser that doesn't support...
Read more >
4.3 Scripting — HTML5 - W3C
When a script element that is not marked as being "parser-inserted" experiences one of the events listed in the following list, the user...
Read more >
Track Non-JavaScript Visits In Google Analytics - Simo Ahava
The steps we're going to take are these: Add a dataLayer key-value pair into the iframe of the noscript element in the GTM...
Read more >
Changelog - NoScript: block scripts and own your browser!
getURL() x REUSE-compliant licensing boilerplate x Remove ... Updated he x Uniform refresh url matching across HTTP and DOM checks (thanks insertscript) v ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found