-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
53 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
import {stringAttribute} from '../shared/attributes.js'; | ||
import {registerHTMLClass} from '../shared/register-html-class.js'; | ||
|
||
import {HTMLElement} from './element.js'; | ||
|
||
/** | ||
* @implements globalThis.HTMLTimeElement | ||
*/ | ||
export class HTMLTimeElement extends HTMLElement { | ||
class HTMLTimeElement extends HTMLElement { | ||
constructor(ownerDocument, localName = 'time') { | ||
super(ownerDocument, localName); | ||
} | ||
|
||
/** | ||
* @type {string} | ||
*/ | ||
get dateTime() { return stringAttribute.get(this, 'datetime'); } | ||
set dateTime(value) { stringAttribute.set(this, 'datetime', value); } | ||
} | ||
|
||
registerHTMLClass('time', HTMLTimeElement) | ||
|
||
export {HTMLTimeElement}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const assert = require('../assert.js').for('HTMLTImeElement'); | ||
|
||
const {parseHTML} = global[Symbol.for('linkedom')]; | ||
|
||
const {document} = parseHTML('<time datetime="1989-06-03 16:00:00">A big event</time>'); | ||
|
||
const {lastElementChild: time} = document; | ||
|
||
assert(time.dateTime, '1989-06-03 16:00:00'); | ||
time.setAttribute('datetime', '1989-06-04 00:00:00'); | ||
assert(time.dateTime, '1989-06-04 00:00:00'); | ||
time.dateTime = '2022-11-26 16:00:00'; | ||
assert(time.getAttribute('datetime'), '2022-11-26 16:00:00'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters