Path: blob/trunk/third_party/closure/goog/dom/browserfeature.js
2868 views
// Copyright 2010 The Closure Library Authors. All Rights Reserved.1//2// Licensed under the Apache License, Version 2.0 (the "License");3// you may not use this file except in compliance with the License.4// You may obtain a copy of the License at5//6// http://www.apache.org/licenses/LICENSE-2.07//8// Unless required by applicable law or agreed to in writing, software9// distributed under the License is distributed on an "AS-IS" BASIS,10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.11// See the License for the specific language governing permissions and12// limitations under the License.1314/**15* @fileoverview Browser capability checks for the dom package.16*17*/181920goog.provide('goog.dom.BrowserFeature');2122goog.require('goog.userAgent');232425/**26* Enum of browser capabilities.27* @enum {boolean}28*/29goog.dom.BrowserFeature = {30/**31* Whether attributes 'name' and 'type' can be added to an element after it's32* created. False in Internet Explorer prior to version 9.33*/34CAN_ADD_NAME_OR_TYPE_ATTRIBUTES:35!goog.userAgent.IE || goog.userAgent.isDocumentModeOrHigher(9),3637/**38* Whether we can use element.children to access an element's Element39* children. Available since Gecko 1.9.1, IE 9. (IE<9 also includes comment40* nodes in the collection.)41*/42CAN_USE_CHILDREN_ATTRIBUTE: !goog.userAgent.GECKO && !goog.userAgent.IE ||43goog.userAgent.IE && goog.userAgent.isDocumentModeOrHigher(9) ||44goog.userAgent.GECKO && goog.userAgent.isVersionOrHigher('1.9.1'),4546/**47* Opera, Safari 3, and Internet Explorer 9 all support innerText but they48* include text nodes in script and style tags. Not document-mode-dependent.49*/50CAN_USE_INNER_TEXT:51(goog.userAgent.IE && !goog.userAgent.isVersionOrHigher('9')),5253/**54* MSIE, Opera, and Safari>=4 support element.parentElement to access an55* element's parent if it is an Element.56*/57CAN_USE_PARENT_ELEMENT_PROPERTY:58goog.userAgent.IE || goog.userAgent.OPERA || goog.userAgent.WEBKIT,5960/**61* Whether NoScope elements need a scoped element written before them in62* innerHTML.63* MSDN: http://msdn.microsoft.com/en-us/library/ms533897(VS.85).aspx#164*/65INNER_HTML_NEEDS_SCOPED_ELEMENT: goog.userAgent.IE,6667/**68* Whether we use legacy IE range API.69*/70LEGACY_IE_RANGES:71goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(9)72};737475