I understand. But there was a way to create a place holder id. I am not
quite remembering correctly but it was either injecting a component version
that is actually not rendered. So we can use the id of this dummy component
for the javascript to write this component.


2013/9/22 Lance Java <lance.j...@googlemail.com>

> > Also if I remember correctly doesnt Tapestry always create unique ids
> for elements
> by adding $number to the components name?
> Whilst it's true that most tapestry components will avoid an id conflict
> when rendering, in this case it's not tapestry rendering the second
> instance. A javascript is using the innerHTML() of one element to create
> another with exactly the same id.
>
>
> On 21 September 2013 20:50, Martin Kersten <martin.kersten...@gmail.com
> >wrote:
>
> > If you can prevent Tapestry from removing your comments, you can just use
> > comments to transfer your data. Walking the dom isnt that costly in java
> > script and if you have a certain div (like the content div etc) you can
> use
> > it as a starting point. Inside the comment you can write any payload you
> > want. We used it in GWT heavily putting json strings inside the comment
> and
> > added a label on top to find the right comment to look at. Sadly tapestry
> > currently removes all comments.
> >
> > So another idea is using javascript and create a certain object that puts
> > the string you want to transfer into it. It is quite easy and you can
> find
> > the object from anywhere of your page by just looking for it. The
> question
> > is how to make it unique and yes you can use UUID or some other
> mechanism.
> >
> > Also if I remember correctly doesnt Tapestry always create unique ids for
> > elements by adding $number to the components name?
> >
> >
> > Cheers,
> >
> > Martin (Kersten)
> >
> >
> > 2013/9/20 Thiago H de Paula Figueiredo <thiag...@gmail.com>
> >
> > > On Fri, 20 Sep 2013 18:48:57 -0300, Dmitry Gusev <
> dmitry.gu...@gmail.com
> > >
> > > wrote:
> > >
> > >  And yes, strictly speaking, this will make the document invalid,
> because
> > >> it violates specification.
> > >> But in practice things won't stop working if you put multiple elements
> > >> with the same ID on a page. You won't see any errors, etc.
> > >>
> > >
> > > It's illegal (you said it was legal) and not recommended but it ends up
> > > working because browsers are lenient, maybe too lenient. ;)
> > >
> > >
> > >  The only side-effect will happen is that you won't be able to get
> > second,
> > >> third, etc. elements by using ID selectors in JS.
> > >> But CSS styling rules will still work. In the example below you will
> see
> > >> content of both divs in UPPERCASE, but jQuery('#id1').length will
> yield
> > 1
> > >> (this will be the first element in the order of appearance in dom),
> also
> > >> document.getElementById("id1") will return first element:
> > >>
> > >
> > > More reasons to avoid duplicate ids: things stop working the way you
> > > expect. :)
> > >
> > >
> > > --
> > > Thiago H. de Paula Figueiredo
> > >
> > >
> ------------------------------**------------------------------**---------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.org<
> > users-unsubscr...@tapestry.apache.org>
> > >
> > > For additional commands, e-mail: users-h...@tapestry.apache.org
> > >
> > >
> >
>

Reply via email to