Skip to content
This repository has been archived by the owner on Jan 12, 2023. It is now read-only.

JS errors on draft controls in Firefox #4

Open
pelargir opened this issue Oct 13, 2009 · 0 comments
Open

JS errors on draft controls in Firefox #4

pelargir opened this issue Oct 13, 2009 · 0 comments

Comments

@pelargir
Copy link
Collaborator

The draft controls were only working for my client in IE and Safari, not in Firefox. When he was clicking on the box to expose the controls, he was getting this error:

this.element.up(".active") is undefined

It looks like the following behavior instruction in concurrent_draft.js was being ignored by Firefox:

'#draft-controls': Draft.ControlBox

Firefox was dropping through and firing a click event on this instead:

'#draft-controls li.schedule_draft a': Draft.ScheduleLink

I spent an hour trying to figure out why this was happening, but eventually was forced to give up and hack in a solution:

Event.addBehavior({
  // This breaks in Firefox for whatever reason
  //'#draft-controls': Draft.ControlBox,
  '#draft-controls:click': function(e) { e.stop(); this.addClassName('active'); },
  'body:click': function() { $('draft-controls').removeClassName('active') },
  '#draft-controls li.revert a': Draft.RevertLink,
  '#draft-controls li.schedule_draft a': Draft.ScheduleLink
});

Thought I'd share it here. I'd love to know a more elegant way to solve this. Clearly, the problem is with Firefox, but it would be nice for the code to work across all three browsers.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant