Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken links in WebIDL for constants #250

Closed
michael-n-cooper opened this issue Jul 26, 2013 · 2 comments
Closed

Broken links in WebIDL for constants #250

michael-n-cooper opened this issue Jul 26, 2013 · 2 comments

Comments

@michael-n-cooper
Copy link
Member

When using respec magic to output WebIDL from special definition lists, it outputs lists of properties about an object, beginning with an index linked to a fuller definition. The expanded definition gets an ID that is concatenated from a few things, and the index link uses the same concatenation to form the in-page link. For most properties (attributes, properties, etc.) this works fine. But for constants, the index link is not concatenated properly and therefore is a broken link to the target.

For example, in https://dvcs.w3.org/hg/IndieUI/raw-file/tip/src/indie-ui-events.html#UIFocusRequestEvent there are a lot of constants defined (UNKNOWN, NAV_FIRST, etc.). All those links in the list at the top are broken; a source inspection shows that the link target is not the same as the ID of the expanded definition of the constant below. However, the link for the attribute focusType, at the bottom of that link, does correctly link to its expanded definition. Therefore it appears to be only constants for which proper link creation is overlooked.

@marcoscaceres
Copy link
Member

On Friday, July 26, 2013 at 8:48 PM, michael-n-cooper wrote:

When using respec magic to output WebIDL from special definition lists, it outputs lists of properties about an object, beginning with an index linked to a fuller definition. The expanded definition gets an ID that is concatenated from a few things, and the index link uses the same concatenation to form the in-page link. For most properties (attributes, properties, etc.) this works fine. But for constants, the index link is not concatenated properly and therefore is a broken link to the target.

A little off topic, but you should not be using constants in the way you are doing anyway. See the big red warning:
http://www.w3.org/TR/WebIDL/#idl-constants

For example, in https://dvcs.w3.org/hg/IndieUI/raw-file/tip/src/indie-ui-events.html#UIFocusRequestEvent there are a lot of constants defined (UNKNOWN, NAV_FIRST, etc.). All those links in the list at the top are broken; a source inspection shows that the link target is not the same as the ID of the expanded definition of the constant below. However, the link for the attribute focusType, at the bottom of that link, does correctly link to its expanded definition. Therefore it appears to be only constants for which proper link creation is overlooked.

It's probably that because specs are not supposed to be using them that this hasn't come up :)

@darobin
Copy link
Member

darobin commented Sep 27, 2013

@michael-n-cooper I can't seem to reproduce the problem. Assuming that you're talking about the enum (rather than constants) I see links generated just fine, they work when clicked, they match the IDs, etc.

Note however that as @marcoscaceres points out, using numeric values like that isn't very friendly to developers and is broadly considered bad practice (see http://berjon.com/blog/2011/06/numerical-constants-must-die.html).

I'm closing for now, please reopen if you can point me to an issue I can reproduce.

@darobin darobin closed this as completed Sep 27, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants