No checkmark in charset menu for current document

VERIFIED DUPLICATE of bug 31708

Status

()

P3
major
VERIFIED DUPLICATE of bug 31708
19 years ago
19 years ago

People

(Reporter: cata, Assigned: cata)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Assignee)

Description

19 years ago
The charset menu is supposed to have a checkmark next to the character set of 
the HTML document currently being viewed by the user. The JS code I am using to 
get to that document is: 

var charset = document.commandDispatcher.focusedWindow.document.characterSet; 
dump("Update current charset: " + charset + "\n"); 

But this code returns the charset of the document contained in the focused 
window! In other words instead of getting the window containing the HTML 
document I may get the "Location" bar window. And if I move the focus manually 
on the HTML window by selecting some text, then the code will return that 
window...

So there are two possibilities here:
a) my code is wrong. In this case, please indicate the right one!
b) there is bug, please fix it.
(Assignee)

Updated

19 years ago
Blocks: 31708
(Assignee)

Updated

19 years ago
Target Milestone: --- → M17

Comment 1

19 years ago
your code is wrong.  when the urlbar is focused, the xul window will be focused.

just add a guard that uses window.content in the case where window == the 
focusedwindow you got from the command dispatcher
Status: NEW → RESOLVED
Last Resolved: 19 years ago
Resolution: --- → INVALID
(Assignee)

Comment 2

19 years ago
The code David suggested is:
    var wnd = document.commandDispatcher.focusedWindow;
    if (window == wnd) wnd = window.content;

    var charset = wnd.document.characterSet;
	dump("Update current charset: " + charset + "\n");

And it works like a charm. Thanks David for the quick fix. You rock!

Comment 3

19 years ago
Reopened and changed summary.
No user feedback creates bad usability bug.
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
Summary: Unexpected result in getter code for the current HTML window → No checkmark in charset menu for current document

Comment 4

19 years ago
Reassigned to cata
Assignee: hyatt → cata
Status: REOPENED → NEW

Comment 5

19 years ago

*** This bug has been marked as a duplicate of 31708 ***
Status: NEW → RESOLVED
Last Resolved: 19 years ago19 years ago
Resolution: --- → DUPLICATE

Comment 6

19 years ago
verified duplicate (or invalid)
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.