-
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.
Merge pull request #1597 from Polymer/1565,1582,1584-fix
1565,1582,1584 fix
- Loading branch information
Showing
12 changed files
with
251 additions
and
14 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
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
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,64 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
|
||
<title>dom-if</title> | ||
|
||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
|
||
<script src="../../../webcomponentsjs/webcomponents-lite.js"></script> | ||
<link rel="import" href="../../polymer.html"> | ||
|
||
</head> | ||
<body> | ||
|
||
<dom-module id='inner-component'> | ||
<template> | ||
<p>inner_before</p> | ||
<template is=dom-if if={{!value}} restamp> | ||
<content></content> | ||
</template> | ||
<p>inner_after</p> | ||
</template> | ||
<script> | ||
Polymer({ | ||
is:'inner-component', | ||
properties: { | ||
attr: String, | ||
value: { type: Boolean, computed: 'computeValue(attr)' }, | ||
}, | ||
computeValue: function(str) { | ||
return str ? true:false; | ||
} | ||
}); | ||
</script> | ||
</dom-module> | ||
|
||
<dom-module id='outer-component'> | ||
<template> | ||
<inner-component id="inner" attr="hi"> | ||
<template is=dom-if if={{outerValue}}> | ||
template | ||
</template> | ||
<p>outer_after</p> | ||
</inner-component> | ||
</template> | ||
<script> | ||
Polymer({ | ||
is:'outer-component', | ||
properties: { | ||
attr: String, | ||
outerValue: { type: Boolean, computed: 'computeOuterValue(attr)' }, | ||
}, | ||
computeOuterValue: function(str) { | ||
return str ? true:false; | ||
} | ||
}); | ||
</script> | ||
</dom-module> | ||
|
||
<outer-component attr='hi'></outer-component> | ||
|
||
</body> | ||
</html> |
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,76 @@ | ||
<!doctype html> | ||
<!-- | ||
@license | ||
Copyright (c) 2014 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 | ||
--> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<script src="../../../webcomponentsjs/webcomponents.js"></script> | ||
<script>Polymer = {dom: 'shadow'};</script> | ||
<link rel="import" href="../../polymer.html"> | ||
</head> | ||
<body> | ||
|
||
<x-outer></x-outer> | ||
|
||
<dom-module id="x-host"> | ||
<template> | ||
Foo: [<content select="[foo]"></content>] | ||
Bar: [<content select="[bar]"></content>] | ||
</template> | ||
<script> | ||
HTMLImports.whenReady(function() { | ||
Polymer({ | ||
is: 'x-host' | ||
}); | ||
}); | ||
</script> | ||
|
||
<dom-module> | ||
|
||
<dom-module id="x-outer"> | ||
<template> | ||
<x-host id="host"> | ||
<child foo>~Foo~</child> | ||
<child foo bar>~Foo+Bar~</child> | ||
<child id="test" bar>~Bar~</child> | ||
</x-host> | ||
<br> | ||
<button on-click="test">Test</button> | ||
<button on-click="test2">Test2</button> | ||
</template> | ||
<script> | ||
HTMLImports.whenReady(function() { | ||
Polymer({ | ||
is: 'x-outer', | ||
|
||
test: function() { | ||
if (this.$.test.hasAttribute('foo')) { | ||
Polymer.dom(this.$.test).removeAttribute('foo'); | ||
} else { | ||
Polymer.dom(this.$.test).setAttribute('foo', 'hi'); | ||
} | ||
}, | ||
|
||
test2: function() { | ||
var pd = Polymer.dom(this.$.test); | ||
if (pd.parentNode) { | ||
Polymer.dom(pd.parentNode).removeChild(this.$.test); | ||
} else { | ||
Polymer.dom(this.$.host).appendChild(this.$.test); | ||
} | ||
} | ||
|
||
}); | ||
}); | ||
</script> | ||
</dom-module> | ||
|
||
</body> | ||
</html> |
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
Oops, something went wrong.