Skip to content

Commit

Permalink
[atoms] Update fragment.bzl to fix a bug where "_" was overwritten (#…
Browse files Browse the repository at this point in the history
…12704)

* Update fragment.bzl to fix bug where "_" was overwritten

Update fragment.bzl to fix bug where "_" was overwritten

* Update fragment.bzl (full revert)

Update fragment.bzl (full revert)
  • Loading branch information
mdmintz committed Sep 14, 2023
1 parent e518273 commit b687c7b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions javascript/private/fragment.bzl
Expand Up @@ -51,11 +51,18 @@ def closure_fragment(

# Wrap the output in two functions. The outer function ensures the
# compiled fragment never pollutes the global scope by using its
# own scope on each invocation.
# own scope on each invocation. We must import window.navigator into
# this unique scope since Closure's goog.userAgent package assumes
# navigator and document are defined on goog.global. Normally, this
# would be window, but we are explicitly defining the fragment so that
# goog.global is _not_ window.
# See http://code.google.com/p/selenium/issues/detail?id=1333
wrapper = (
"function(){" +
"return (function(){%output%; return this._.apply(null,arguments);}).apply(" +
"window, arguments);}"
"return (function(){%output%; return this._.apply(null,arguments);}).apply({" +
"navigator:typeof window!='undefined'?window.navigator:null," +
"document:typeof window!='undefined'?window.document:null" +
"}, arguments);}"
)

browser_defs = {
Expand Down

0 comments on commit b687c7b

Please sign in to comment.