# lib/goog/dom/browserfeature.js

    1// Copyright 2010 The Closure Library Authors. All Rights Reserved.2//3// Licensed under the Apache License, Version 2.0 (the "License");4// you may not use this file except in compliance with the License.5// You may obtain a copy of the License at6//7//      http://www.apache.org/licenses/LICENSE-2.08//9// Unless required by applicable law or agreed to in writing, software10// distributed under the License is distributed on an "AS-IS" BASIS,11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12// See the License for the specific language governing permissions and13// limitations under the License.1415/**16 * @fileoverview Browser capability checks for the dom package.17 *18 */192021goog.provide('goog.dom.BrowserFeature');2223goog.require('goog.userAgent');242526/**27 * Enum of browser capabilities.28 * @enum {boolean}29 */30goog.dom.BrowserFeature = {31  /**32   * Whether attributes 'name' and 'type' can be added to an element after it's33   * created. False in Internet Explorer prior to version 9.34   */35  CAN_ADD_NAME_OR_TYPE_ATTRIBUTES: !goog.userAgent.IE ||36      goog.userAgent.isDocumentModeOrHigher(9),3738  /**39   * Whether we can use element.children to access an element's Element40   * children. Available since Gecko 1.9.1, IE 9. (IE<9 also includes comment41   * nodes in the collection.)42   */43  CAN_USE_CHILDREN_ATTRIBUTE: !goog.userAgent.GECKO && !goog.userAgent.IE ||44      goog.userAgent.IE && goog.userAgent.isDocumentModeOrHigher(9) ||45      goog.userAgent.GECKO && goog.userAgent.isVersionOrHigher('1.9.1'),4647  /**48   * Opera, Safari 3, and Internet Explorer 9 all support innerText but they49   * include text nodes in script and style tags. Not document-mode-dependent.50   */51  CAN_USE_INNER_TEXT: (52      goog.userAgent.IE && !goog.userAgent.isVersionOrHigher('9')),5354  /**55   * MSIE, Opera, and Safari>=4 support element.parentElement to access an56   * element's parent if it is an Element.57   */58  CAN_USE_PARENT_ELEMENT_PROPERTY: goog.userAgent.IE || goog.userAgent.OPERA ||59      goog.userAgent.WEBKIT,6061  /**62   * Whether NoScope elements need a scoped element written before them in63   * innerHTML.64   * MSDN: http://msdn.microsoft.com/en-us/library/ms533897(VS.85).aspx#165   */66  INNER_HTML_NEEDS_SCOPED_ELEMENT: goog.userAgent.IE,6768  /**69   * Whether we use legacy IE range API.70   */71  LEGACY_IE_RANGES: goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(9)72};