-
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 #2090 from Polymer/fix-flush
Shady DOM rendering + Polymer.dom.flush improvements
- Loading branch information
Showing
14 changed files
with
1,395 additions
and
917 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,86 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
|
||
<title>dom-bind</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" async> | ||
|
||
<script> | ||
document.querySelector('link').addEventListener('load', function() { | ||
app.render(); | ||
}); | ||
</script> | ||
|
||
</head> | ||
<body> | ||
|
||
<template is="dom-bind" id="app"> | ||
|
||
<h3>Repeat index</h3> | ||
<template is="dom-repeat" items="{{employees}}"> | ||
<div style="padding: 3px 0px;"> | ||
<button on-tap="modify">Modify</button> | ||
<span>{{index}}</span> | ||
<span>{{item.first}}</span> | ||
<span>{{item.last}}</span> | ||
</div> | ||
</template> | ||
|
||
<h3>Show person by index, demonstrate "dom-if" expressions</h3> | ||
<template is="dom-repeat" items="{{employees}}"> | ||
<div> | ||
<template is="dom-if" if="{{testit(index)}}"> | ||
<div style="padding: 3px 0px;"> | ||
<button on-tap="modify">Modify</button> | ||
<span>{{index}}</span> | ||
<span>{{item.first}}</span> | ||
<span>{{item.last}}</span> | ||
</div> | ||
</template> | ||
</div> | ||
</template> | ||
|
||
<h3>Show person by index, demonstrate filter</h3> | ||
<template is="dom-repeat" items="{{employees}}" filter="onlyRob"> | ||
<div> | ||
<div style="padding: 3px 0px;"> | ||
<button on-tap="modify">Modify</button> | ||
<span>{{index}}</span> | ||
<span>{{item.first}}</span> | ||
<span>{{item.last}}</span> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
</template> | ||
|
||
<script> | ||
var logEl = document.getElementById('log'); | ||
var app = document.getElementById('app'); | ||
app.testit = function(i) { | ||
return i > 1; | ||
}; | ||
app.modify = function(e) { | ||
e.model.set('item.last', e.model.item.last + '*'); | ||
}; | ||
app.onlyRob = function(item) { | ||
return item.first == 'Rob'; | ||
}; | ||
app.bar = true; | ||
app.employees = [ | ||
{first: 'Bob', last: 'Smith'}, | ||
{first: 'Sally', last: 'Johnson'}, | ||
{first: 'Rob', last: 'Instructs'}, | ||
{first: 'Scott', last: 'Explains'}, | ||
{first: 'Taylor', last: 'Blogs'} | ||
]; | ||
|
||
</script> | ||
|
||
</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,55 @@ | ||
<!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 | ||
--> | ||
<script src="../../../webcomponentsjs/webcomponents-lite.js"></script> | ||
<link rel="import" href="../../polymer.html"> | ||
|
||
<body> | ||
<x-test></x-test> | ||
|
||
<dom-module id="x-foo"> | ||
<template> | ||
<content></content> | ||
</template> | ||
<script> | ||
HTMLImports.whenReady(function() { | ||
Polymer({ | ||
is: 'x-foo' | ||
}); | ||
}); | ||
</script> | ||
</dom-module> | ||
|
||
<dom-module id="x-test"> | ||
<template> | ||
Greeting: | ||
<x-foo id="myCustomElement"></x-foo> | ||
</template> | ||
<script> | ||
HTMLImports.whenReady(function() { | ||
Polymer({ | ||
is: 'x-test', | ||
attached: function() { | ||
var appendTo = this.$.myCustomElement, | ||
t = document.createElement('template', 'dom-bind'), | ||
span = document.createElement('span'); | ||
span.innerHTML = '{{hello}}'; | ||
t.content.appendChild(span); | ||
t.hello = 'hey'; | ||
Polymer.dom(appendTo).appendChild(t); | ||
} | ||
}); | ||
}); | ||
</script> | ||
</dom-module> | ||
|
||
|
||
</body> | ||
|
Oops, something went wrong.