1.0.2 • Published 9 months ago

@wernerglinka/truncatedaptitle v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

TruncatedAPTitle

Custom element with a couple of unique attributes: apstyle and textlength.

Safari doesn't support customized built-in element! Version 1.0.0 is now an autonomous custom element. It does not require the use of a webcomponents polyfill.

The TruncatedAPTitle web component applies AP title case styling to the text within it and trims it down to the specified length

npm: version license: ISC

Installation

npm install truncatedaptitle

Important: Since truncatedaptitle relies on a child for its initial setup, e.g. the textContent, we need to insure that the document is fully parsed before the truncatedaptitle constructor is called. This is done by adding the defer attribute to the script tag that loads the truncatedaptitle module. The defer attribute specifies that the script is downloaded in parallel to parsing the page, and executed after the page has finished parsing.

Usage

<truncated-aptitle apstyle textlength="30">Headline goes here</truncated-aptitle>

Attributes

AttributeTypeDescription
textlengthStringThe string length
apstylebooleanIf present, the title will be converted to AP Title Case.

License

MIT

Author

Werner Glinka

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago

0.0.14

9 months ago

0.0.13

9 months ago

0.0.12

9 months ago

0.0.11

9 months ago

0.0.10

9 months ago

0.0.9

9 months ago

0.0.8

9 months ago

0.0.7

9 months ago

0.0.6

9 months ago

0.0.5

9 months ago

0.0.4

9 months ago

0.0.3

9 months ago

0.0.2

9 months ago

0.0.1

9 months ago