[Pkg-javascript-commits] [pdf.js] 47/246: Use CSS.supports instead of '..' in ....style

David Prévot taffit at moszumanska.debian.org
Sun Sep 7 15:36:24 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit 8bb96db3a0eff104ff0517fa810f0110e54c581a
Author: Rob Wu <rob at robwu.nl>
Date:   Wed Jul 30 23:05:09 2014 +0200

    Use CSS.supports instead of '..' in ....style
    
    document.documentElement.style is null in some XML documents.
    The previous snippet caused the following error:
    
    Uncaught TypeError: Cannot use 'in' operator to search for 'animation' in null
    
    To fix this bug, `'animation' in document.documentElement.style` has been
    replaced with `CSS.supports('animation', '9s')`. This method was introduced
    in Chromium 28, but it is not necessary to detect whether this method is
    supported because the required createShadowRoot method for embeds is not
    available in Chromium 32 and earlier.
---
 extensions/chromium/contentscript.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/extensions/chromium/contentscript.js b/extensions/chromium/contentscript.js
index 531e0f7..e17c15f 100644
--- a/extensions/chromium/contentscript.js
+++ b/extensions/chromium/contentscript.js
@@ -15,7 +15,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
-/* globals chrome */
+/* globals chrome, CSS */
 
 'use strict';
 
@@ -45,7 +45,7 @@ if (typeof Element.prototype.createShadowRoot !== 'undefined') {
 
 // Only observe the document if we can make use of Shadow DOM.
 if (createShadowRoot) {
-  if ('animation' in document.documentElement.style) {
+  if (CSS.supports('animation', '0s')) {
     document.addEventListener('animationstart', onAnimationStart, true);
   } else {
     document.addEventListener('webkitAnimationStart', onAnimationStart, true);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list