Last active
August 29, 2015 14:26
-
-
Save notwaldorf/44da856a3debdc8ab289 to your computer and use it in GitHub Desktop.
No `offsetParent` in the `attached` callback in Chrome
This file contains hidden or 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 lang="en"> | |
<head> | |
<title>offset parent demo</title> | |
<link rel="import" href="some-thing.html"> | |
</head> | |
<body> | |
<some-thing></some-thing> | |
</body> | |
</html> |
This file contains hidden or 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
<link rel="import" href="../../polymer/polymer.html"> | |
<dom-module id="some-thing"> | |
<template> | |
<div>hi</div> | |
</template> | |
<script> | |
Polymer({ | |
is: 'some-thing', | |
attached: function() { | |
console.log(window.getComputedStyle(this.parentNode).position); | |
console.log(this.offsetParent); | |
} | |
}) | |
</script> | |
</dom-module> |
This file contains hidden or 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> | |
<head> | |
<meta charset="utf-8"> | |
<link rel="import" href="../../polymer/polymer.html"> | |
<script> | |
var proto = Object.create(HTMLElement.prototype); | |
proto.attachedCallback = function() { | |
//if (!this.offsetParent) { | |
console.log(window.getComputedStyle(this.parentNode).position); | |
console.log(this.offsetParent); | |
//} | |
}; | |
proto.createdCallback = function() { | |
console.log('hi'); | |
}; | |
document.registerElement('a-thing', {prototype:proto}); | |
</script> | |
</head> | |
<body> | |
<a-thing></a-thing> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment