Ticket #472 (closed defect: fixed)

Opened 5 years ago

Last modified 2 years ago

invalid tiddler IDs (due to spaces)

Reported by: FND Owned by: MartinBudden
Priority: major Milestone: 2.6.3
Component: core Version:
Severity: medium Keywords: webStandards
Cc:

Description (last modified by FND) (diff)

As discussed  here, tiddler IDs generated from the respective tiddler's title can contain spaces, resulting in  invalid IDs. Thus spaces should be removed or replaced in IDs.

Rationale

Apart from conforming to web standards, this would also make it easier to use CSS ID selectors.

Potential Problems

Plugins assuming that the ID for a story tiddler is story.idPrefix + tiddler.title would become non-functional in some cases. However, fixing this should be very simple.

Change History

Changed 5 years ago by FND

  • owner changed from JeremyRuston to FND
  • status changed from new to assigned

Changed 5 years ago by MartinBudden

  • milestone set to 2.3.1

MartinB - sent comments to Fred about how to improve patches and deleted current patches

Changed 5 years ago by FND

  • owner FND deleted
  • status changed from assigned to new
  • description modified (diff)

Changed 5 years ago by FND

  • description modified (diff)

Changed 5 years ago by FND

cross reference: This issue is closely related to #475.

Changed 5 years ago by MartinBudden

  • milestone changed from 2.3.1 to 2.4

Changed 5 years ago by EricShulman

"Plugins assuming that the ID for a story tiddler is story.idPrefix + tiddler.title would become non-functional in some cases. However, fixing this should be very simple."

This assumption likely occurs in ALL plugins that are currently assembling tiddler DOM element IDs from tiddler titles, and would have a VERY LARGE IMPACT on the installed base, and should NOT be done without extensive review and a lengthy 'beta' shakedown.

If at all possible, a backward-compatible switch should be provided to ease the upgrade path (allowing older plugins to continue working until users choose to update them).

While the rationale given for this change makes sense (i.e., web standards, and CSS use of ID selectors), given the potential problems that can arise, I don't think it is a compelling justification for making this change.

Changed 5 years ago by MartinBudden

  • milestone changed from 2.4 to 2.5

Changed 4 years ago by FND

  • milestone changed from 2.5.1 to 2.6

Changed 4 years ago by FND

  • priority changed from trivial to minor
  • severity changed from trivial to medium
  • milestone changed from 2.6 to 2.5.2

This appears to be of increased significance in the context of jQuery:
 space in tiddler name makes for a bad element id

Changed 4 years ago by FND

  • milestone changed from 2.5.3 to 2.5.4

Changed 4 years ago by MartinBudden

  • status changed from new to closed
  • resolution set to wontfix

Cannot fix without breaking backwards compatibility.

Changed 2 years ago by jdlrobson

  • status changed from closed to reopened
  • resolution wontfix deleted

I'd urge us to reopen this for discussion. Standards are there for a reason.

The latest version of jQuery doesn't seem to support selectors within elements with bad ids. For instance jQuery(".toolbar", document.getElementById("id with spaces")) doesn't work correctly - it almost matches nothing. If the element with id "id with spaces" has an attribute tiddler set to "New Tiddler" jQuery(".toolbar", jQuery("[tiddler=New Tiddler]")[0]).length doesn't work correctly either - it always matches nothing. There is no obvious reason why they would want to fix something that is non standard.

This is going to break many of my plugins for any tiddlers with spaces in their titles which frequently do $(selector, story.getTiddler(title))

On a side note, I wonder whether this will really impact many plugins. TiddlyWiki' story has a getTiddler method that would still function given such a change. Any plugins that don't use the story.getTiddler method to retrieve the dom element should be updated to do so they are doing it wrong. That's what API's are for - to provide correct, reliable and resilient ways to access data. Possibly we might imagine a quirks mode or a plugin which fixes the problems on the short term whilst plugins are updated.

Changed 2 years ago by FND

  • priority changed from minor to major
  • milestone changed from 2.6 to 2.6.3

+1

Changed 2 years ago by MartinBudden

  • owner set to MartinBudden
  • status changed from reopened to new
  • milestone changed from 2.6.3 to 2.6.2

Changed 2 years ago by MartinBudden

  • milestone changed from 2.6.2 to 2.7

Changed 2 years ago by MartinBudden

  • status changed from new to closed
  • resolution set to fixed
  • milestone changed from 2.7 to 2.6.3

Fixed in changeset:12707

Note: See TracTickets for help on using tickets.