Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a custom element name for highlight spans #172

Merged
merged 1 commit into from
Dec 20, 2016

Conversation

robertknight
Copy link
Member

Use the same trick that was applied to the adder in
d9644a8 to reduce the likelihood of the
page's own CSS styling modifying the appearance of highlights.

Compared to alternative methods which raise the precedence of
highlight styling (inline styles, !important !all !the !things, selector
precedence hacks), this approach is simpler as it makes the conflicting
rule from the page's own styling not apply at all.

The "hypothesis-" prefix matches the prefix used for the adder's container.

Fixes hypothesis/h#3520

Use the same trick that was applied to the adder in
d9644a8 to reduce the likelihood of the
page's own CSS styling modifying the appearance of highlights.

Compared to alternative methods which would raise the precedence of
highlight styling (inline styles, !important !all !the !things, selector
precedence hacks), this approach is simpler as it makes the conflicting
rule from the page's own styling not apply at all.

Fixes hypothesis/h#3520
@sean-roberts
Copy link
Contributor

we need to make sure good cross-browser testing is done with this as well.

@robertknight robertknight requested a review from seanh December 16, 2016 14:30

# A custom element name is used here rather than `<span>` to reduce the
# likelihood of highlights being hidden by page styling.
hl = $("<hypothesis-highlight class='#{cssClass}'></hypothesis-highlight>")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like the CSS class is a bit redundant now, so perhaps in future we could look into removing that.

@nickstenning
Copy link
Contributor

Code LGTM. @robertknight if you confirm that you've tested this with our supported browsers, we'll merge it.

In future, please chase PRs like this for a review so that they don't have to sit around for nearly a month.

@robertknight
Copy link
Member Author

Code LGTM. @robertknight if you confirm that you've tested this with our supported browsers, we'll merge it.

Yes. Tested with Chrome, Firefox, Edge, IE & Mobile Safari.

@robertknight robertknight merged commit 445b106 into master Dec 20, 2016
@robertknight robertknight deleted the highlight-custom-element branch December 20, 2016 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

<span> styling hides highlighted links on page
3 participants