1 // Copyright 2010 The Closure Library Authors. All Rights Reserved.
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 at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // 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 and
13 // limitations under the License.
16 * @fileoverview Browser capability checks for the dom package.
21 goog.provide('goog.dom.BrowserFeature');
23 goog.require('goog.userAgent');
27 * Enum of browser capabilities.
30 goog.dom.BrowserFeature = {
32 * Whether attributes 'name' and 'type' can be added to an element after it's
33 * created. False in Internet Explorer prior to version 9.
35 CAN_ADD_NAME_OR_TYPE_ATTRIBUTES: !goog.userAgent.IE ||
36 goog.userAgent.isDocumentModeOrHigher(9),
39 * Whether we can use element.children to access an element's Element
40 * children. Available since Gecko 1.9.1, IE 9. (IE<9 also includes comment
41 * nodes in the collection.)
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'),
48 * Opera, Safari 3, and Internet Explorer 9 all support innerText but they
49 * include text nodes in script and style tags. Not document-mode-dependent.
52 goog.userAgent.IE && !goog.userAgent.isVersionOrHigher('9')),
55 * MSIE, Opera, and Safari>=4 support element.parentElement to access an
56 * element's parent if it is an Element.
58 CAN_USE_PARENT_ELEMENT_PROPERTY: goog.userAgent.IE || goog.userAgent.OPERA ||
59 goog.userAgent.WEBKIT,
62 * Whether NoScope elements need a scoped element written before them in
64 * MSDN: http://msdn.microsoft.com/en-us/library/ms533897(VS.85).aspx#1
66 INNER_HTML_NEEDS_SCOPED_ELEMENT: goog.userAgent.IE,
69 * Whether we use legacy IE range API.
71 LEGACY_IE_RANGES: goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(9)