angular-route + web-components crash - Chrome 42.0.2311.90
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> | |
<html> | |
<body ng-app="app"> | |
<ng-view></ng-view> | |
<template id='my-component-template'> | |
<style> | |
@import url('whatever...'); | |
</style> | |
</template> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.js"></script> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-route.js"></script> | |
<script> | |
function MyComponent() {} | |
MyComponent.prototype = Object.create(HTMLElement.prototype); | |
MyComponent.prototype.createdCallback = function() { | |
var template = document.getElementById('my-component-template'); | |
var clone = document.importNode(template.content, true); | |
var shadow = this.createShadowRoot(); | |
shadow.appendChild(clone); // this line crashes Chrome 42.0.2311.90 | |
}; | |
document.registerElement('my-component', MyComponent); | |
angular | |
.module('app', ['ngRoute']) | |
.config(function($routeProvider) { | |
$routeProvider.otherwise({ | |
template: '<div ng-repeat="item in list"><my-component></my-component></div>' | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment