it looks like innerHTML does not exist (undefined) for anonymous
elements;
snippet:
<binding id="container">
<content>
<xul:div style="" class="container-wrapper">
<children/>
</xul:div>
</content>
<implementation>
<field name="containerEl"
readonly="true">document.getAnonymousElementByAttribute(this, 'class',
'container-wrapper' );</field>
<constructor>
<![CDATA[
console.log(this.containerEl); // works
console.log(this.containerEl.innerHTML); //undefined
]]>
</constructor>
</implementation>
</binding>
the workaround to add something from the constructor (or an handler)
is of course to do an addChild, which works perfectly. still I'm
wondering whether this is a bug or a feature, since I've seen an
example here:
http://www.builderau.com.au/program/web/soa/Creating-reusable-Web-components-for-Mozilla/0,339024632,339186903,00.htm
which does exactly that.
thanks!
Stefano
console.log(this.containerEl.childNodes); is empty for
> <content>
> <xul:div style="" class="container-wrapper">
> <children/>
> </xul:div>
> </content>
but will contain the node <div>Stefano</div> from the following
snippet
> <content>
> <xul:div style="" class="container-wrapper">
> <div>Stefano</div>
> <children/>
> </xul:div>
> </content>
> example here:http://www.builderau.com.au/program/web/soa/Creating-reusable-Web-com...
A xul:div is not an html element, so there is no innerHTML property for that.
You'll have to use html:div.
Regards,
Martijn
> thanks!
> Stefano
> _______________________________________________
> dev-tech-xbl mailing list
> dev-te...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-tech-xbl
>
--
Martijn Wargers - Help Mozilla!
http://quality.mozilla.org/
http://wiki.mozilla.org/Mozilla_QA_Community
irc://irc.mozilla.org/qa - /nick mw22
>Related:
>
>console.log(this.containerEl.childNodes); is empty for
>
>> <content>
>> <xul:div style="" class="container-wrapper">
>> <children/>
>> </xul:div>
>> </content>
>>
>>
This is correct behaviour. The nodes in this.childNodes aren't listed as
anything else's childNodes, even though that's where they appear to be.
--
Warning: May contain traces of nuts.
indeed, html:div works to get an innerHTML even though i still see
some weird behaviors, but I guess I'm one the right track now.
Thanks!