Open Source DOM Component
Standing on the shoulders of giantsby Read Write Tools
|The rwt-newton DOM component displays document references using standardized styling.|
In the wild
To see an example of this component in use, visit the Compleat Botanica website. This component typically has no visible UI. To understand what's going on under the hood, use the browser's inspector to view the HTML source code and network activity, and follow along as you read this documentation.
The rwt-newton DOM component works in any browser that supports modern W3C standards. Templates are written using BLUEPHRASE notation, which can be compiled into HTML using the free Read Write View desktop app. It has no other prerequisites. Distribution and installation are done with either NPM or via Github.
Installation using NPM
If you are familiar with Node.js and the
package.json file, you'll be comfortable installing the component just using this command:
npm install rwt-newton
If you are a front-end Web developer with no prior experience with NPM, follow these general steps:
- Install Node.js/NPM on your development computer.
- Create a
package.jsonfile in the root of your web project using the command:
npm install rwt-newton
Important note: This DOM component uses Node.js and NPM and
package.json as a convenient distribution and installation mechanism. The DOM component itself does not need them.
Installation using Github
If you are more comfortable using Github for installation, follow these steps:
- Create a directory
node_modulesin the root of your web project.
- Clone the rwt-newton DOM component into it using the command:
git clone https://github.com/readwritetools/rwt-newton.git
Using the DOM component
After installation, you need to add two things to your HTML page to make use of it.
- Add a
scripttag to load the component's
<script src='/node_modules/rwt-newton/rwt-newton.js' type=module></script>
span slot=h2The h2 heading text (optional).
span slot=h3The h3 heading text (optional).
span slot=dtA definition term.
span slot=ddA definition description. This typically has an anchor tag with the external reference.
Here's an example:
<span slot=h3>Isaac Newton</span>
<span slot=dt>Famous quotes</span>
<span slot=dd><a href='https://example.com/shoulders-of-giants.html'> If I Have Seen Further</a> Using the understanding gained by major thinkers who have gone before in order to make intellectual progress.</span>
The reference area has limited customization. Only the background color may be customized. Supply a background color using the
<rwt-newton role=navigation background='#777'>
The component issues life-cycle events.
- Sent when the component is fully loaded and ready to be used. As a convenience you can use the
waitOnLoading()method which returns a promise that resolves when the
component-loadedevent is received. Call this asynchronously with
|Documentation||READ WRITE HUB|
|Component catalog||DOM COMPONENTS|
|Publication venue||READ WRITE STACK|
The rwt-newton DOM component is licensed under the MIT License.
Copyright © 2020 Read Write Tools.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.