Closed
Bug 84098
Opened 24 years ago
Closed 21 years ago
Link properties dialog doesn't display id
Categories
(SeaMonkey :: Composer, defect, P3)
SeaMonkey
Composer
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla1.2beta
People
(Reporter: basic, Assigned: basic)
Details
Attachments
(3 files, 9 obsolete files)
1.36 KB,
text/html
|
Details | |
427 bytes,
text/html
|
Details | |
4.64 KB,
patch
|
Details | Diff | Splinter Review |
As per HTML 4 section 12.2.3 http://www.w3.org/TR/html4/struct/links.html#h-12.2.3
"The id attribute may be used to create an anchor at the start tag of any
element (including the A element)"
The Link properties dialog should include ids in its list of anchors
Testcase:
1 open testcase http://bugzilla.mozilla.org/showattachment.cgi?attach_id=37129
in composer
2 right click on "this is a link"
3 select "link properties"
4 click on "More Properties"
5 the ids on the page should appear in the named anchor list
Updated•24 years ago
|
OS: Windows 98 → All
Hardware: PC → All
Comment 3•24 years ago
|
||
moving to 1.0
Assignee: beppe → cmanske
Priority: -- → P3
Target Milestone: --- → mozilla1.0
Comment 4•24 years ago
|
||
Wow! Learn something new everyday! This will have to wait until next
version, of course.
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Comment 5•24 years ago
|
||
This is somewhat complicated to implement:
We would have to grovel through all elements and build a list of IDs.
The should probably be in a separate list, as are the Headings.
Note also:
1. The "name" attribute allows entities, while the id does not.
2. An <a> element with both "id" and "name" must use same string,
3. "Name" and "id" share namespace (no duplicates!)
It also seems like id can simplify the way we create links to headings:
Instead of putting an <a name="foo"></a> before a heading, just add an id="foo"
to the heading tag directly.
how is the current <a name=""> anchor list implemented? Does it use
getElementsByTagName ? Seems like we need something like IE's document.all ;)
id can simplify the way we create links to anything! But do we need to allow <a
name=""> creation for backward compatibility?
what about the xul getElementsByAttribute ? Maybe we can use that.
see also the xhtml 1 guidlines http://www.w3.org/TR/html/#guidelines (section
C.8 Fragment Identifiers)
Comment 8•24 years ago
|
||
I agree, using ID is really better for creating internal document jumps, but I'm
sure we will have to support standard named anchors for awhile.
Using getElementsByAttribute is a good idea -- I'll look into it.
Updated•23 years ago
|
Target Milestone: mozilla1.1alpha → mozilla1.2beta
Assignee | ||
Comment 12•22 years ago
|
||
This adds the ids to the named anchor list in the link property dialog
Assignee | ||
Comment 13•21 years ago
|
||
here's a new patch. Per request of Glazman, I made the xpath expression select
the named anchors' names as well as IDs. And do a sort before adding them to
the menu popup.
Attachment #125368 -
Attachment is obsolete: true
Assignee | ||
Comment 14•21 years ago
|
||
ok, I just tested the patch in composer standalone and it does not work. Seems
like composer standalone does not have xpath? Maybe because xslt (transformiix)
is not compiled in?
Assignee | ||
Comment 15•21 years ago
|
||
Since xpath does not work in composer standalone. Here's a patch that uses
treeWalker instead. I've made some changes to make sure that there are no
duplicates and case insensitive sorting is used.
Attachment #138105 -
Attachment is obsolete: true
Assignee | ||
Comment 16•21 years ago
|
||
oops missed a strict warning
Attachment #138155 -
Attachment is obsolete: true
Assignee | ||
Comment 17•21 years ago
|
||
oops uploaded the wrong patch. Must be one of those days...
Attachment #138156 -
Attachment is obsolete: true
Assignee | ||
Comment 18•21 years ago
|
||
Comment on attachment 138159 [details] [diff] [review]
patch v3
glazman suggested I ask Neil for review of this patch
Attachment #138159 -
Flags: superreview?(neil.parkwaycc.co.uk)
Attachment #138159 -
Flags: review?(neil.parkwaycc.co.uk)
Comment 19•21 years ago
|
||
Comment on attachment 138159 [details] [diff] [review]
patch v3
>+ const nodeFilter =
Don't need this.
>+ const treeWalker = editor.document.createTreeWalker(editor.document, 1, nodeFilter, true);
I don't like using const, except for numbers, strings, atoms or interfaces.
+ var anchorMap = {}; // for weeding out duplicates and making heading
anchors unique
If you use {"": true} then you can save some tests below.
>+ while (element = treeWalker.nextNode())
JS strict warning, sorry
>+ if ((element.tagName.search(/^H[1-6]$/) != -1) &&
As a regexp, the test is best written /^H[1-6]$/.test(element.tagName)/
But neatest is (element instanceof HTMLHeadingElement)
>+ !((child = element.firstChild) && child.nodeName == "A" && child.name.length))
element.firstChild instanceof HTMLAnchorElement && element.name
>+ if (text.length)
if (text) will do.
>+ if(element.tagName == "A")
if (element.firstChild instanceof HTMLAnchorElement)
>+ anchor = '#' + element.name;
>+ if((anchor.length > 1) && !(anchor in anchorMap))
I suggest you don't include the # in the map, then you can use !(element.name
in anchorMap) and merge it into the previous if.
>+ anchor = '#' + element.id;
>+ if((anchor.length > 1) && !(anchor in anchorMap))
Same here, use !(element.id in anchorMap)
>+ delete headingList;
>+ delete anchorMap;
Unnecessary (and probably useless - the syntax is delete x.y or x[y])
>+ for (i = 0; i < anchorList.length; i++)
>+ {
>+ createMenuItem(menupopup,anchorList[i].anchor);
>+ }
It looks as if brace style in this file is to omit braces for single lines.
Attachment #138159 -
Flags: superreview?(neil.parkwaycc.co.uk)
Attachment #138159 -
Flags: review?(neil.parkwaycc.co.uk)
Attachment #138159 -
Flags: review-
Assignee | ||
Comment 20•21 years ago
|
||
>>+ const nodeFilter =
>Don't need this.
fixed
>>+ const treeWalker = editor.document.createTreeWalker(editor.document, 1,
nodeFilter, true);
>I don't like using const, except for numbers, strings, atoms or interfaces.
fixed
>+ var anchorMap = {}; // for weeding out duplicates and making heading
anchors unique
>If you use {"": true} then you can save some tests below.
I'm not sure if it'll help in this case
>>+ while (element = treeWalker.nextNode())
>JS strict warning, sorry
fixed
>>+ if ((element.tagName.search(/^H[1-6]$/) != -1) &&
>As a regexp, the test is best written /^H[1-6]$/.test(element.tagName)/
>But neatest is (element instanceof HTMLHeadingElement)
fixed
>>+ !((child = element.firstChild) && child.nodeName == "A" &&
child.name.length))
>element.firstChild instanceof HTMLAnchorElement && element.name
fixed
>>+ if (text.length)
>if (text) will do.
fixed
>>+ if(element.tagName == "A")
>if (element.firstChild instanceof HTMLAnchorElement)
fixed
>>+ anchor = '#' + element.name;
>>+ if((anchor.length > 1) && !(anchor in anchorMap))
>I suggest you don't include the # in the map, then you can use !(element.name
in anchorMap) and merge it into the previous if.
I think I need the '#' since the anchor name might turn out to be something
like toSource, constructor, prototype, valueOf...
>>+ anchor = '#' + element.id;
>>+ if((anchor.length > 1) && !(anchor in anchorMap))
>Same here, use !(element.id in anchorMap)
>>+ delete headingList;
>>+ delete anchorMap;
>Unnecessary (and probably useless - the syntax is delete x.y or x[y])
fixed
>>+ for (i = 0; i < anchorList.length; i++)
>>+ {
>>+ createMenuItem(menupopup,anchorList[i].anchor);
>>+ }
>It looks as if brace style in this file is to omit braces for single lines.
fixed
Attachment #138159 -
Attachment is obsolete: true
Attachment #138286 -
Flags: superreview?(neil.parkwaycc.co.uk)
Attachment #138286 -
Flags: review?(neil.parkwaycc.co.uk)
Assignee | ||
Comment 21•21 years ago
|
||
Assignee | ||
Comment 22•21 years ago
|
||
Attachment #138286 -
Attachment is obsolete: true
Comment 23•21 years ago
|
||
Comment on attachment 138286 [details] [diff] [review]
patch v4
I don't think that "child" is used any more; your ( and , spacing is
inconsistent; your comment should be "grab named anchors"; otherwise r=me
Attachment #138286 -
Flags: superreview?(neil.parkwaycc.co.uk)
Attachment #138286 -
Flags: review?(neil.parkwaycc.co.uk)
Attachment #138286 -
Flags: review+
Assignee | ||
Comment 24•21 years ago
|
||
>I don't think that "child" is used any more; your ( and , spacing is
inconsistent; your comment should be "grab named anchors"; otherwise r=me
1) removed child
2) fixup ( and , spacing
3) add back comment about skipping headings with named anchors as their first
child. Was removed by mistake
should be ready for checkin
Attachment #138288 -
Attachment is obsolete: true
Attachment #138321 -
Flags: approval1.6?
Attachment #138321 -
Flags: superreview?(bugs)
Comment 25•21 years ago
|
||
Comment on attachment 138321 [details] [diff] [review]
patch v6
1.6- go ahead and get this on the trunk for 1.7
Attachment #138321 -
Flags: approval1.6? → approval1.6-
Attachment #138321 -
Flags: superreview?(bugs) → superreview?(brendan)
Comment 26•21 years ago
|
||
Comment on attachment 138321 [details] [diff] [review]
patch v6
I'd like neil to restamp.
/be
Attachment #138321 -
Flags: review?(neil.parkwaycc.co.uk)
Comment 27•21 years ago
|
||
Comment on attachment 138321 [details] [diff] [review]
patch v6
Thanks to interdiff :-)
Attachment #138321 -
Flags: review?(neil.parkwaycc.co.uk) → review+
Comment 28•21 years ago
|
||
Comment on attachment 138321 [details] [diff] [review]
patch v6
>>+ // grab IDs
>+ if (element.id) {
Divergent brace style alert! Fix that and sr=me.
Cool patch.
/be
Attachment #138321 -
Flags: superreview?(brendan) → superreview+
Assignee | ||
Comment 29•21 years ago
|
||
(In reply to comment #28)
> (From update of attachment 138321 [details] [diff] [review])
> >>+ // grab IDs
> >+ if (element.id) {
>
> Divergent brace style alert! Fix that and sr=me.
Fixed
Assignee | ||
Comment 30•21 years ago
|
||
oops, accidentally inserted tabs in the last patch.
Attachment #138321 -
Attachment is obsolete: true
Attachment #140215 -
Attachment is obsolete: true
Comment 31•21 years ago
|
||
Fix checked in.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Updated•20 years ago
|
Product: Browser → Seamonkey
You need to log in
before you can comment on or make changes to this bug.
Description
•