Project

General

Profile

Actions

Feature #14936

open

Use a stable and modifiable data structure for jsToolbar elements

Added by Felix Schäfer over 10 years ago. Updated over 10 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:

Description

The elements of the jsToolbar are currently stored in a javascript {} (see source:/trunk/public/javascripts/jstoolbar/jstoolbar.js@12152#L153) and are read in the hopes they will come out in the same order they have been put in (see source:/trunk/public/javascripts/jstoolbar/jstoolbar.js@12152#L213). This however is not a specified behavior of javascript, it just happens to work in most browsers (Chrome being the exception here in certain cases (sorry for the weird anchor of the link, the enclosing section has none)). The specification explicitly states:

The […] order of enumerating the properties […] is not specified.

(see ECMA-262 12.6.4)

We (Planio) haven't seen any bugs with the current implementation but find it lacking in that we cannot add a button at a specific position in the toolbar without adding it to core js files (which has become more difficult since the jstoolbar-textile.min.js is shipped with core without any apparent clues how it is generated, but that's not the point here).

Would the Redmine team be open to switching the aforementioned jsToolBar.prototype.elements to a data structure with a guaranteed ordering and the ability to add elements at a specified absolute ("at position X") or relative ("after button X") place?


Related issues

Related to Redmine - Feature #14937: Code highlighting toolbar buttonClosedJean-Philippe Lang

Actions
Actions

Also available in: Atom PDF