Comments (5)
@cadwmaster this is happening because you aren't setting a non-inline display
value for your element in CSS (custom elements default to display: inline;
) - basically this causes the element to act like a <span>
, which is why it reports zeros for its height and width ;)
Here it is will display: block;
applied, works fine: http://codepen.io/csuwldcat/pen/dgpna
from core.
Can you try logging this information in the inserted lifecyle event. Also what happens if you console.log those properties after the DOMCmponentsLoaded event ?
from core.
I put also in the inserted event with the same result:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>X-Tag - Test</title>
<link rel="stylesheet" type="text/css" href="http://www.x-tags.org/css/x-tag-components.css"/>
<script type="text/javascript" src="http://www.x-tags.org/js/x-tag-components.min.js"></script>
<script type="text/javascript">
xtag.register('x-holder', {
lifecycle:{
created: function(){
this.innerHTML = "<div style='width: 500px; height: 500px; border: 1px solid red;'></div>";
},
inserted: function(){
console.log("*********Inserted**********");
console.log('Y: ' + this.offsetHeight);
console.log('X: ' + this.offsetWidth);
},
}
});
window.onload=function(){
var holder = document.getElementById("test");
console.log("*********Loaded Page**********");
console.log('Y: ' + holder.offsetHeight);
console.log('X: ' + holder.offsetWidth);
};
</script>
</head>
<body>
<x-holder id='test'> </x-holder>
</body>
</html>
And the result is still the same:
_Inserted_*
Y: 0
X: 0
_Loaded Page_*
Y: 0
X: 0
from core.
@cadwmaster this isn't a library issue or bug (as the above comment highlights). Barring any feedback to the contrary, I'd like to close this out - let me know if everything works with the CSS display added to your x-holder
elements.
from core.
Thanks a lot, It's not a bug, but I didn't find a place to ask about it.
from core.
Related Issues (20)
- this.innerHTML in V2 throws recursion error. HOT 33
- enhancement question HOT 4
- this.outerHTML is undefined HOT 5
- Setter on attr camel cases doesn't set the proper dashed attribute value. HOT 6
- Using setAttribute is unstable HOT 3
- Is this project still supported? Are any additional releases planned? HOT 1
- template attr from last commit
- v2 docs Pseudos versus Jasmine tests
- include information about ie9 -ie11 compat HOT 3
- experimenting with type renders
- Ability to define placeholder for inner HTML HOT 3
- V1 lifecycle compatibility HOT 4
- Website :: Clock not operating properly on safari mobile HOT 4
- IDEA: V1 FINAL PATCH HOT 4
- XTagElement is not defined HOT 3
- Issues @ x-tag.github.io/docs
- package.json needs to be updated HOT 2
- lit-element? I'm confused :/
- Migration guide || equivalents of inserted/...? HOT 1
- Status of project HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from core.