Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update browser list for custom elements #179

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions packages/core-web-example/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import "@mrhenry/core-web/modules/Intl.~locale.fr-FR";
var event = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
console.log(event.toLocaleString('nl-BE', { timeZone: 'UTC' }));

customElements.define('mr-x', class extends HTMLElement {

})
customElements.define('mr-x', class extends HTMLElement {});

// ["@mrhenry/core-web", {
// browsers: {
Expand Down
7 changes: 5 additions & 2 deletions packages/core-web-generator/generate-webcomponents.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,12 @@ async function generateCustomElements(mapping) {
edge: "<79",
edge_mob: "*",
firefox: "<63",
safari: "*",
safari: "<11",
ie: "*",
opera: "<64"
opera: "<64",
op_mob: "<46",
op_mini: "*",
samsung_mob: '<8'
},
detector: true
});
Expand Down
15 changes: 15 additions & 0 deletions packages/core-web-tests/src/test_customElements.define.extends.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
QUnit.skip('customElements.define with extends', function (assert) {
class TestElementExtender extends HTMLButtonElement {
foo() {
return 'baz';
}
}

customElements.define('test-element-extender', TestElementExtender, { extends: 'button' });
const fixture = document.getElementById('qunit-fixture');

fixture.innerHTML = '<button is="test-element-extender"></button>';

const el = fixture.querySelector('button');
assert.equal(el.foo(), 'baz');
});
28 changes: 14 additions & 14 deletions packages/core-web-tests/src/test_customElements.define.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
QUnit.test("customElements.define", function(assert) {
QUnit.test('customElements.define', function(assert) {
class TestElementA extends HTMLElement {
foo() {
return "baz";
return 'baz';
}
}

customElements.define("test-element-a", TestElementA);
const fixture = document.getElementById("qunit-fixture");
customElements.define('test-element-a', TestElementA);
const fixture = document.getElementById('qunit-fixture');

fixture.innerHTML = "<test-element-a></test-element-a>";
fixture.innerHTML = '<test-element-a></test-element-a>';

const el = fixture.querySelector("test-element-a");
assert.equal(el.foo(), "baz");
const el = fixture.querySelector('test-element-a');
assert.equal(el.foo(), 'baz');
});

QUnit.test("customElements.connectedCallback", function(assert) {
QUnit.test('customElements.connectedCallback', function(assert) {
class TestElementB extends HTMLElement {
constructor() {
super();

this._content = "rendered content";
this._content = 'rendered content';
}

connectedCallback() {
this.innerHTML = this._content || "";
this.innerHTML = this._content || '';
}
}

customElements.define("test-element-b", TestElementB);
const fixture = document.getElementById("qunit-fixture");
customElements.define('test-element-b', TestElementB);
const fixture = document.getElementById('qunit-fixture');
const elStart = new TestElementB();

fixture.appendChild(elStart);

const elOut = fixture.querySelector("test-element-b");
assert.equal(elOut.innerHTML, "rendered content");
const elOut = fixture.querySelector('test-element-b');
assert.equal(elOut.innerHTML, 'rendered content');
});
7 changes: 5 additions & 2 deletions packages/core-web/helpers/__mapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -22933,9 +22933,12 @@ module.exports = [
"edge": "<79",
"edge_mob": "*",
"firefox": "<63",
"safari": "*",
"safari": "<11",
"ie": "*",
"opera": "<64"
"opera": "<64",
"op_mob": "<46",
"op_mini": "*",
"samsung_mob": "<8"
},
"detector": true
},
Expand Down