Last active
December 28, 2015 04:19
-
-
Save jorgehatccrma/7441374 to your computer and use it in GitHub Desktop.
Code to demonstrate a bug with polymer+jquery
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
<polymer-element name="gr-test"> | |
<template> | |
<p>Hi there!</p> | |
</template> | |
<script> | |
Polymer('gr-test', { | |
ready: function() { | |
console.log("ready"); | |
}, | |
aMethod: function () { | |
console.log("calling a method"); | |
}, | |
}); | |
</script> | |
</polymer-element> |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"> | |
<head> | |
<!-- 1. Load Polymer before any code that touches the DOM. --> | |
<script src="libs/polymer.min.js"></script> | |
<!-- 2. Load components --> | |
<link rel="import" href="gr-test.html"> | |
<script type="text/javascript" src="libs/jquery-1.9.1.js"></script> | |
</head> | |
<body> | |
<gr-test></gr-test> | |
<script> | |
$(document).ready(function () { | |
var test = document.querySelector("gr-test"); | |
console.log(test); | |
test.aMethod(); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment