]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1580909 - remove broken javascript used to support IE7
authorbyron jones <byron@glob.com.au>
Tue, 17 Sep 2019 20:33:40 +0000 (04:33 +0800)
committerdklawren <dklawren@users.noreply.github.com>
Tue, 17 Sep 2019 20:33:40 +0000 (16:33 -0400)
extensions/TrackingFlags/template/en/default/bug/tracking_flags.html.tmpl
extensions/TrackingFlags/template/en/default/hook/bug/field-editable.html.tmpl
js/field.js
template/en/default/bug/field.html.tmpl

index 3fbb622de7ccde323e30473f6886fb5e8c98d90b..17b0ab8285d518c7ab07f901ea0881b69510d445 100644 (file)
@@ -32,9 +32,6 @@
               [% value.name FILTER html %]</option>
           [% END %]
         </select>
-        <script [% script_nonce FILTER none %]>
-          initHidingOptionsForIE('[% flag.name FILTER js %]');
-        </script>
         [% IF !new_bug && user.id %]
           <span id="ro_[% flag.name FILTER html %]" class="bz_default_hidden">
             [%  flag_bug_value FILTER html %]
index 91f89ea734ecb5395ccd80ae0768537e7968c3a8..9ff1a56f64c59ec8d0cbe5d66d40b257a2346245 100644 (file)
     </option>
   [% END %]
 </select>
-<script [% script_nonce FILTER none %]>
-<!--
-  initHidingOptionsForIE('[% field.name FILTER js %]');
-  [%+ INCLUDE "bug/field-events.js.tmpl"
-      field = field, product = bug.product_obj %]
-//-->
-</script>
index b21704cd314ac868b8f37ac074ac918247d355c7..ae0393f59276267e1bbc52798e673708aecb24d2 100644 (file)
@@ -575,7 +575,6 @@ function handleValControllerChange(e, args) {
         var item = getPossiblyHiddenOption(controlled_field,
                                            controlled_value_ids[i]);
         if (item.disabled && controller_item && controller_item.selected) {
-            item = showOptionInIE(item, controlled_field);
             YAHOO.util.Dom.removeClass(item, 'bz_hidden_option');
             item.disabled = false;
         }
@@ -586,7 +585,6 @@ function handleValControllerChange(e, args) {
                 bz_fireEvent(controlled_field, 'change');
             }
             item.disabled = true;
-            hideOptionInIE(item, controlled_field);
         }
     }
 }
@@ -597,112 +595,6 @@ function _value_id(field_name, id) {
     return 'v' + id + '_' + field_name;
 }
 
-/*********************************/
-/* Code for Hiding Options in IE */
-/*********************************/
-
-/* IE 7 and below (and some other browsers) don't respond to "display: none"
- * on <option> tags. However, you *can* insert a Comment Node as a
- * child of a <select> tag. So we just insert a Comment where the <option>
- * used to be. */
-var ie_hidden_options = new Array();
-function hideOptionInIE(anOption, aSelect) {
-    if (browserCanHideOptions(aSelect)) return;
-
-    var commentNode = document.createComment(anOption.value);
-    commentNode.id = anOption.id;
-    // This keeps the interface of Comments and Options the same for
-    // our other functions.
-    commentNode.disabled = true;
-    // replaceChild is very slow on IE in a <select> that has a lot of
-    // options, so we use replaceNode when we can.
-    if (anOption.replaceNode) {
-        anOption.replaceNode(commentNode);
-    }
-    else {
-        aSelect.replaceChild(commentNode, anOption);
-    }
-
-    // Store the comment node for quick access for getPossiblyHiddenOption
-    if (!ie_hidden_options[aSelect.id]) {
-        ie_hidden_options[aSelect.id] = new Array();
-    }
-    ie_hidden_options[aSelect.id][anOption.id] = commentNode;
-}
-
-function showOptionInIE(aNode, aSelect) {
-    if (browserCanHideOptions(aSelect)) return aNode;
-
-    // We do this crazy thing with innerHTML and createElement because
-    // this is the ONLY WAY that this works properly in IE.
-    var optionNode = document.createElement('option');
-    optionNode.innerHTML = aNode.data;
-    optionNode.value = aNode.data;
-    optionNode.id = aNode.id;
-    // replaceChild is very slow on IE in a <select> that has a lot of
-    // options, so we use replaceNode when we can.
-    if (aNode.replaceNode) {
-        aNode.replaceNode(optionNode);
-    }
-    else {
-        aSelect.replaceChild(optionNode, aNode);
-    }
-    delete ie_hidden_options[aSelect.id][optionNode.id];
-    return optionNode;
-}
-
-function initHidingOptionsForIE(select_name) {
-    var aSelect = document.getElementById(select_name);
-    if (browserCanHideOptions(aSelect)) return;
-
-    for (var i = 0; ;i++) {
-        var item = aSelect.options[i];
-        if (!item) break;
-        if (item.disabled) {
-          hideOptionInIE(item, aSelect);
-          i--; // Hiding an option means that the options array has changed.
-        }
-    }
-}
-
-function getPossiblyHiddenOption(aSelect, optionId) {
-    // Works always for <option> tags, and works for commentNodes
-    // in IE (but not in Webkit).
-    var id = _value_id(aSelect.id, optionId);
-    var val = document.getElementById(id);
-
-    // This is for WebKit and other browsers that can't "display: none"
-    // an <option> and also can't getElementById for a commentNode.
-    if (!val && ie_hidden_options[aSelect.id]) {
-        val = ie_hidden_options[aSelect.id][id];
-    }
-
-    return val;
-}
-
-var browser_can_hide_options;
-function browserCanHideOptions(aSelect) {
-    /* As far as I can tell, browsers that don't hide <option> tags
-     * also never have a X position for <option> tags, even if
-     * they're visible. This is the only reliable way I found to
-     * differentiate browsers. So we create a visible option, see
-     * if it has a position, and then remove it. */
-    if (typeof(browser_can_hide_options) == "undefined") {
-        var new_opt = bz_createOptionInSelect(aSelect, '', '');
-        var opt_pos = YAHOO.util.Dom.getX(new_opt);
-        aSelect.removeChild(new_opt);
-        if (opt_pos) {
-            browser_can_hide_options = true;
-        }
-        else {
-            browser_can_hide_options = false;
-        }
-    }
-    return browser_can_hide_options;
-}
-
-/* (end) option hiding code */
-
 /**
  * Autocompletion
  */
index 4aa4dddfc38bd0651b0b1e9ffb39dd0da67da299..f12ed22d7767199e3fbccab9037a1fb5d189e7cd 100644 (file)
           <input type="hidden" name="defined_[% field.name FILTER html %]">
         [% END %]
 
-        <script [% script_nonce FILTER none %]>
-        <!--
-          initHidingOptionsForIE('[% field.name FILTER js %]');
-          [%+ INCLUDE "bug/field-events.js.tmpl"
-                      field = field, product = bug.product_obj %]
-        //-->
-        </script>
-
      [% CASE constants.FIELD_TYPE_TEXTAREA %]
        <div id="[% field.name FILTER html %]_edit_container" class="bz_default_hidden">
          <div>