Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
add 'injectBoundHtml' utility, restore standard index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott J. Miles committed Jun 18, 2014
1 parent ba2b68f commit 6d7076f
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
23 changes: 23 additions & 0 deletions index.html
@@ -0,0 +1,23 @@
<!doctype html>
<!--
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
The complete set of authors may be found at http://polymer.github.io/AUTHORS
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
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
-->
<html>
<head>

<script src="../platform/platform.js"></script>
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../core-component-page/core-component-page.html">

</head>
<body unresolved>

<core-component-page sources='["polymer.html"]'></core-component-page>

</body>
</html>
18 changes: 17 additions & 1 deletion src/instance/utils.js
Expand Up @@ -71,7 +71,7 @@
this.async("fire", arguments);
},
/**
* Remove class from old, add class to anew, if they exist
* Remove class from old, add class to anew, if they exist.
* @param classFollows
* @param anew A node.
* @param old A node
Expand All @@ -84,6 +84,22 @@
if (anew) {
anew.classList.add(className);
}
},
/**
* Inject HTML which contains markup bound to this element into
* a target element (replacing target element content).
* @param String html to inject
* @param Element target element
*/
injectBoundHTML: function(html, element) {
var template = document.createElement('template');
template.innerHTML = html;
var fragment = this.instanceTemplate(template);
if (element) {
element.textContent = '';
element.appendChild(fragment);
}
return fragment;
}
};

Expand Down

0 comments on commit 6d7076f

Please sign in to comment.