nytimes / backbone.stickit

Backbone data binding, model binding plugin. The real logic-less templates.
MIT License
1.64k stars 176 forks source link

Multiple DOM elements with matching ID's - is this legal? #320

Open Fandangi opened 6 years ago

Fandangi commented 6 years ago

Hi - thanks for the great plugin. I noticed that for itemviews, stickit produces multiple dom elements with identical id properties.

For example

{ firstName: "Tom"},{firstName: "Dick"},{firstName: "Harry")

passed into a stickit enabled view of

  • will produce

  • Tom
  • Dick
  • Harry
  • My question is - is it allowed to have these multiple DOM elements with the same ID?

    Thanks.

    [PS. I realise this is an old and stable plugin now and this may not be answered for a while...a bit like the Heiniken complaints line ad...]

    vendethiel commented 6 years ago

    It's at least considered a very bad practice to have different ids. I'm not sure the behavior is defined.

    Fandangi commented 6 years ago

    Thanks for responding so soon. That being the case, are you aware of any option in stickit to clear the id's after rendering, or carry out some other strategy? I am quite happily using stickit with Marionette 3.5 views and it works like a charm so I am loathe to have to replace it when it works so smoothly.