Skip to content

Instantly share code, notes, and snippets.

@JanMiksovsky
Created May 29, 2013 00:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JanMiksovsky/5667061 to your computer and use it in GitHub Desktop.
Save JanMiksovsky/5667061 to your computer and use it in GitHub Desktop.
This test case for Polymer contrasts three similar situations in which a test element is used, but one of them is "upgraded" (converted from plain DOM to custom element instance) in an unexpected manner.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="../polymer/polymer.js"></script>
<element name="test-element">
<template>
BEGIN <content></content> END
</template>
<script>
Polymer.register( this );
</script>
</element>
</head>
<body>
<!-- Three test cases with slightly different containers and contents. -->
<!-- Works as expected -->
<h3>Case #1</h3>
<test-element>
<div>top-level custom element with content in div</div>
</test-element>
<!-- Does NOT work as expected -->
<h3>Case #2</h3>
<p>
<test-element>
<div>p holding custom element with content in div</div>
</test-element>
</p>
<!-- Works as expected -->
<h3>Case #3</h3>
<p>
<test-element>
<span>p holding custom element with content in span</span>
</test-element>
</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment