Skip to content
This repository was archived by the owner on Sep 20, 2019. It is now read-only.

Commit a4c8bf5

Browse files
treshugartjustinfagnani
authored andcommitted
Fixes #555. Add CustomElementRegistry.prototype.get().
1 parent 5229a0b commit a4c8bf5

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/CustomElements/v1/CustomElements.js

+6
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,12 @@ var CustomElementDefinition;
150150
this._addNodes(doc.childNodes);
151151
}
152152

153+
// http://w3c.github.io/webcomponents/spec/custom/#dom-customelementsregistry-get
154+
get(localName) {
155+
const def = this._definitions.get(localName);
156+
return def ? def.constructor : undefined;
157+
}
158+
153159
flush() {
154160
this._handleMutations(this._observer.takeRecords());
155161
}

tests/CustomElements/v1/js/customElements.js

+7
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,13 @@ suite('customElements', function() {
313313
done();
314314
});
315315

316+
test('customElements.get', function (done) {
317+
class XBoo extensd HTMLElement {}
318+
customElements.define('x-boo-get', XGetTest);
319+
assert.equal(XBoo, customElements.get('x-boo-get'));
320+
done();
321+
});
322+
316323
test('document.registerElement disconnectedCallbacks in prototype', function(done) {
317324
var ready, inserted, removed;
318325
class XBoo extends HTMLElement {

0 commit comments

Comments
 (0)