Be notified of new releases
Create your free GitHub account today to subscribe to this repository for new releases and build software alongside 28 million developers.Sign up
- Added an option for customizable
ariaLabel. The default ("Anchor") should be suitable for many cases, but this option allows for translations.
- Improves docs.
- Based on the feedback of screenreader users, I changed the default ARIA-text from "Permalink for: <title>" to "Anchor". See #63.
- Any Links or generated IDs containing a
>character will have them removed. Those characters are not appropriate in IDs because they are part of the CSS language spec. See #81.
- We removed
h1from the default selector applied when
anchors.add()is called without arguments. Before:
h1, h2, h3, h4, h5, h6. After:
h2, h3, h4, h5, h6. See #75.
- Added the ability to link to other IDs on the page (like those on wrapper or
<section>elements). This means you can use AnchorJS for highlighted sections. See the docs, or the related issues: #83 and #87
- Many documentation improvements and clarifications.
- Prevents a console error that would occur when running
add()on a selector with no elements, followed by a chained method. See #79
- #59 - Add support for Node, AMD, & CommonJS (Via UMD)
- When installing via bower, ignore package.json.
These changes improve compatibility & code inclusion, but should not affect functionality at all.
- Resolves #50, by exposing the list of anchored elements at
anchors.elements. External code can use this list to do things like building a table of contents or jump-nav.
- Prevents multiple anchors from being added to the same element (and thus, duplicate elements from being in the elements list)
anchors.removeto optionally take an array of elements or a nodeList instead of the selector-string only.
- Improves tests and updates dev-dependencies.
Removes the "trim" option, making a the trimming of URL strings part of the default process.
Also updates dev dependencies, organizes tests and makes them more granular.
If you are updating to 3.0.0, it's possible that a generated URL may change if text that AnchorJS uses to generate the ID had special whitespace characters before or after it. These characters (like newlines and carriage returns) are now being trimmed. Simple spaces were being trimmed before, and thus should not be affected.
Adds the following features:
- A new option
anchors.options.visible= "touch". This option makes anchors visible via hover on non-touch devices, but always visible on touch devices. See #47.
- A new option
anchors.options.trim = truefor trimming whitespace around targeted html text before converting the text into url-friendly IDs. See #43.