main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[d24f17c] | 1 | const Element = require('../primitives/Element');
|
---|
| 2 |
|
---|
| 3 | /** Hyperlinking MAY be used to link to other resources, provide links to
|
---|
| 4 | * instructions on how to process a given element (by way of a profile or
|
---|
| 5 | * other means), and may be used to provide meta data about the element in
|
---|
| 6 | * which it's found. The meaning and purpose of the hyperlink is defined by
|
---|
| 7 | * the link relation according to RFC 5988.
|
---|
| 8 | *
|
---|
| 9 | * @class LinkElement
|
---|
| 10 | *
|
---|
| 11 | * @param content
|
---|
| 12 | * @param meta
|
---|
| 13 | * @param attributes
|
---|
| 14 | */
|
---|
| 15 | module.exports = class LinkElement extends Element {
|
---|
| 16 | constructor(content, meta, attributes) {
|
---|
| 17 | super(content || [], meta, attributes);
|
---|
| 18 | this.element = 'link';
|
---|
| 19 | }
|
---|
| 20 |
|
---|
| 21 | /**
|
---|
| 22 | * The relation identifier for the link, as defined in RFC 5988.
|
---|
| 23 | * @type StringElement
|
---|
| 24 | */
|
---|
| 25 | get relation() {
|
---|
| 26 | return this.attributes.get('relation');
|
---|
| 27 | }
|
---|
| 28 |
|
---|
| 29 | set relation(relation) {
|
---|
| 30 | this.attributes.set('relation', relation);
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | /**
|
---|
| 34 | * The URI for the given link.
|
---|
| 35 | * @type StringElement
|
---|
| 36 | */
|
---|
| 37 | get href() {
|
---|
| 38 | return this.attributes.get('href');
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | set href(href) {
|
---|
| 42 | this.attributes.set('href', href);
|
---|
| 43 | }
|
---|
| 44 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.