Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

no innerHTML for anonymous elements?

1 view
Skip to first unread message

StefanoC

unread,
Jul 9, 2009, 10:06:27 AM7/9/09
to
sorry to keep on filling up this group, but i've been searching for
these questions all over!

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

stefano

unread,
Jul 9, 2009, 10:20:16 AM7/9/09
to
Related:

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...

Martijn

unread,
Jul 9, 2009, 10:34:05 AM7/9/09
to StefanoC, dev-te...@lists.mozilla.org


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

Neil

unread,
Jul 9, 2009, 12:11:35 PM7/9/09
to
stefano wrote:

>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.

stefano

unread,
Jul 12, 2009, 8:03:16 PM7/12/09
to
thanks Neil and Martijn !

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!

0 new messages