-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implements
disable-upgrade
attribute which prevents readying an ele…
…ment until the attribute is removed.
- Loading branch information
Steven Orvell
committed
Mar 9, 2017
1 parent
4ae65ba
commit a222078
Showing
8 changed files
with
421 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,6 +57,7 @@ | |
|
||
constructor() { | ||
super(); | ||
this.root = this; | ||
this.created(); | ||
} | ||
|
||
|
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
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
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,98 @@ | ||
<!-- | ||
@license | ||
Copyright (c) 2017 The Polymer Project Authors. All rights reserved. | ||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt | ||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | ||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt | ||
Code distributed by Google as part of the polymer project is also | ||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt | ||
--> | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="../../../webcomponentsjs/webcomponents-lite.js"></script> | ||
<link rel="import" href="../../polymer.html"> | ||
</head> | ||
<body> | ||
|
||
<dom-module id="x-child"> | ||
<template> | ||
<style> | ||
:host { | ||
display: block; | ||
border: 2px solid lightgreen; | ||
margin: 2px; | ||
padding: 2px; | ||
}; | ||
</style> | ||
<div>I'm a child, yo!</div> | ||
</template> | ||
<script> | ||
HTMLImports.whenReady(function() { | ||
class XChild extends Polymer.Element { | ||
static get is() { return 'x-child'} | ||
static get properties() { | ||
return { | ||
prop: { value: 'hi'} | ||
} | ||
} | ||
} | ||
customElements.define(XChild.is, XChild); | ||
}); | ||
</script> | ||
</dom-module> | ||
|
||
|
||
<dom-module id="x-test"> | ||
<template> | ||
<style> | ||
:host { | ||
display: block; | ||
border: 2px solid orange; | ||
padding: 2px; | ||
}; | ||
</style> | ||
<div>element says: {{prop}}</div> | ||
<x-child id="child" disable-upgrade$="[[disabled]]"></x-child> | ||
</template> | ||
<script> | ||
HTMLImports.whenReady(function() { | ||
class XTest extends Polymer.Element { | ||
static get is() { return 'x-test'} | ||
static get properties() { | ||
return { | ||
prop: { value: 'hi'}, | ||
disabled: {value: true} | ||
} | ||
} | ||
|
||
ready() { | ||
super.ready(); | ||
setTimeout(() => { | ||
// this.$.child.removeAttribute('disable-upgrade'); | ||
this.disabled = false; | ||
}, 1000) | ||
} | ||
} | ||
customElements.define(XTest.is, XTest); | ||
}); | ||
</script> | ||
</dom-module> | ||
|
||
|
||
<h2>Enabled</h2> | ||
<x-test></x-test> | ||
<x-test></x-test> | ||
<h2>Disabled</h2> | ||
<script> | ||
function go() { | ||
Array.from(document.querySelectorAll('[disable-upgrade]')) | ||
.forEach((e) => e.removeAttribute('disable-upgrade')); | ||
} | ||
</script> | ||
<button onclick="go()">Go</button> | ||
<x-test id="one" disable-upgrade></x-test> | ||
<x-test id="two" disable-upgrade></x-test> | ||
|
||
</body> | ||
</html> |
Oops, something went wrong.