Breaking Changes:
- Any Links or generated IDs containing a
<or>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 whenanchors.add()is called without arguments. Before:h1, h2, h3, h4, h5, h6. After:h2, h3, h4, h5, h6. See #75.
Features:
- 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.
Bug Fixes:
- Prevents a console error that would occur when running
add()on a selector with no elements, followed by a chained method. See #79
Downloads
Includes font optimizations from #70 for a smaller filesize.
Downloads
Fixes #67 - A bug where bundling AnchorJS with other scripts could cause 'use script' declarations to apply to external code.
Downloads
Fixes:
- #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.
Downloads
Fixes #56, a regression where errors are caused when attempting to add (or remove) anchors from empty html tags.
Downloads
Updates include:
- 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)
- Allows
anchors.addandanchors.removeto optionally take an array of elements or a nodeList instead of the selector-string only. - Adds
anchors.removeAll(). - Improves tests and updates dev-dependencies.
Downloads
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.
Compatibility Notice:
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.
Downloads
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.
Downloads
Features:
- Adds support for international characters.
- Adds a
truncateoption, allowing people to choose the maximum ID length generated by AnchorJS.
Other Improvements:
- Added several more tests around transforming text into URL-friendly IDs.
- Added JSDoc-formatted comments throughout the code.
- Tighten up the API - use private functions within closures for internal AnchorJS code.
- Updated Dev Dependencies.
Notes:
This is a major version update because generated IDs containing non-ASCII characters could change, resulting in the potential for existing hyperlinks to no longer link to the correct place on the page. In these cases, hyperlinks will still link to the same page, but to the top of the page instead of the correct location on the page.
Only URLs containing non-ASCII unicode characters (including non-latin letters) are affected.
Previously:
Заголовок, содержащий 29 не-ASCII символов ---> 29-ascii
Now:
Заголовок, содержащий 29 не-ASCII символов ---> заголовок-содержащий-29-не-ascii-символов
Downloads
Also updates dev dependencies, including a major update to Eslint.