[Laszlo-dev] setNodeName setter function on LzDataElement not being called
Henry Minsky
henry.minsky at gmail.com
Mon Aug 21 12:28:24 EDT 2006
The test case is in the data test
test/lfc/data/alldata.lzx
in the file
datapointerdependencies.lzx
where it calls
nen.setAttribute( 'nodeName' , "bar" );
The setters field is undefined at that point on the element pointed to by
nen
On 8/21/06, P T Withington <ptw at openlaszlo.org> wrote:
>
> Hm. What is your test case? I'll take a look.
>
> On 2006-08-21, at 08:54 EDT, Henry Minsky wrote:
>
> > Actually the 'setters' property itself is undefined...
> >
> >
> > On 8/21/06, P T Withington <ptw at openlaszlo.org> wrote:
> >>
> >> What is the value of nen.setters.setNodeName at the call site?
> >>
> >>
> >> On 2006-08-21, at 00:52 EDT, Henry Minsky wrote:
> >>
> >> > So there's been this one test failing in the data test suite for a
> >> > long time
> >> > , and I finally tracked it down to
> >> > what seems to be this problem; the setter function (setNodename)
> >> > for the
> >> > "nodeName" attribute does not seem to be getting called
> >> > on LzDataElement
> >> >
> >> >
> >> > In the test case this line of code
> >> >
> >> > nen.setAttribute( 'nodeName' , "bar" );
> >> >
> >> > doesn't call the setNodeName setter on LzDataElement. It does
> >> > directly set
> >> > the nodeName property though.
> >> >
> >> > But if I replace the call above with this line which calls the
> >> setter
> >> > directly, then everything works (i.e., some other
> >> > important events are sent by the setter function)
> >> > nen.setNodeName( "bar" );
> >> >
> >> > So, the question is why isn't this setter getting dispatched to by
> >> > setAttribute. I haven't gotten that far yet, but
> >> > I wonder if it has something to do with LzDataElement being defined
> >> > by a
> >> > trait.
> >> > The trait is defined in LzDataElement.lzs with an initializer like
> >> > this
> >> >
> >> > LzDataElementTrait = Trait.make(
> >> > "LzDataElementTrait",
> >> > null,
> >> > // N.B.: LzDataElementTrait may or may not be an LzNode, so
> >> > // _if_ it were to have an initialize method, it would have to
> >> > // match LzNode.initialize's signature.
> >> > null,
> >> > function LzDataElementTraitInitialize (prototype) {
> >> > // There will be no setters property in the trait prototype,
> >> > // (and you don't want one there! as it would shadow the one
> >> > // from LzNode) but it will be there after LzNode.initialize
> >> > // runs
> >> > if (prototype.hasOwnProperty('setters')) {
> >> > // since you can't assign directly to these slots...
> >> > // until LzNode.initialize has run
> >> > prototype.setters.attributes = "setAttrs";
> >> > prototype.setters.childNodes = "setChildNodes";
> >> > prototype.setters.nodeName = "setNodeName";
> >> > // Shouldn't be directliy settable
> >> > prototype.setters.ownerDocument = "setOwnerDocument";
> >> > }
> >> > }
> >> > );
> >> >
> >> >
> >> > Maybe there's something wrong with the way this is trying to add
> >> > setters?
> >> >
> >> >
> >> > --
> >> > Henry Minsky
> >> > Software Architect
> >> > hminsky at laszlosystems.com
> >>
> >>
> >
> >
> > --
> > Henry Minsky
> > Software Architect
> > hminsky at laszlosystems.com
>
>
--
Henry Minsky
Software Architect
hminsky at laszlosystems.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20060821/a7bf454f/attachment.html
More information about the Laszlo-dev
mailing list