Skip to content

[JavaScript] Move 'isDisplayed' atom to be typescript#17316

Merged
AutomatedTester merged 1 commit into
trunkfrom
atoms-ts-isdisplayed
May 11, 2026
Merged

[JavaScript] Move 'isDisplayed' atom to be typescript#17316
AutomatedTester merged 1 commit into
trunkfrom
atoms-ts-isdisplayed

Conversation

@AutomatedTester

Copy link
Copy Markdown
Member

🔗 Related Issues

💥 What does this PR do?

Addiditive PR that moves Python code to use the newly created isDisplayed TypeScript implementation

🔧 Implementation Notes

💡 Additional Considerations

🔄 Types of changes

  • New feature (non-breaking change which adds functionality and tests!)

Copilot AI review requested due to automatic review settings April 8, 2026 14:32
@selenium-ci selenium-ci added C-py Python Bindings B-atoms JavaScript chunks generated by Google closure C-nodejs JavaScript Bindings B-build Includes scripting, bazel and CI integrations labels Apr 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new TypeScript-based implementation of the isDisplayed/isShown atom, wires it into Bazel targets, and switches the Python binding’s packaged isDisplayed.js to use the new implementation.

Changes:

  • Added a new TypeScript isShown implementation plus corresponding JS artifacts (is-displayed.js, is-displayed-global.js).
  • Added a new is-displayed-typescript fragment target and a selenium-webdriver is_displayed_typescript module build target.
  • Updated the Python Bazel packaging step to copy the TypeScript-based fragment as selenium/webdriver/remote/isDisplayed.js, and added new QUnit HTML tests for the TS variant.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
py/BUILD.bazel Switches Python’s packaged isDisplayed.js atom source to the new TS-based fragment output.
javascript/selenium-webdriver/lib/atoms/BUILD.bazel Adds a build rule to wrap the TS-based fragment for Node/module consumption.
javascript/atoms/typescript/is-displayed.ts Adds the new TypeScript source implementation of isShown.
javascript/atoms/typescript/is-displayed.js Adds the JS artifact used as the fragment source for Bazel/copying.
javascript/atoms/typescript/is-displayed-global.js Adds a global window.bot.dom.typescript.isShown build used by HTML tests.
javascript/atoms/test/shown_typescript_test.html Adds a TS-focused clone of the existing shown_test.html.
javascript/atoms/test/html5/shadow_dom_typescript_test.html Adds a TS-focused clone of the existing shadow-dom shown tests.
javascript/atoms/fragments/BUILD.bazel Adds a new fragment target that copies in the TS-based implementation.
javascript/atoms/BUILD.bazel Expands the atoms filegroup glob to include **/*.ts.

Comment thread javascript/atoms/typescript/is-displayed.ts
Comment thread javascript/atoms/typescript/is-displayed.ts
Comment thread javascript/atoms/typescript/is-displayed.js Outdated
Comment thread javascript/atoms/typescript/is-displayed.js Outdated
Comment thread javascript/atoms/typescript/is-displayed-global.js Outdated
Comment thread javascript/atoms/test/shown_typescript_test.html Outdated
Comment thread javascript/atoms/test/shown_typescript_test.html Outdated
Comment thread javascript/atoms/typescript/is-displayed.ts Outdated
Comment thread javascript/atoms/typescript/is-displayed.ts
Comment thread javascript/atoms/typescript/is-displayed.js Outdated
Copilot AI review requested due to automatic review settings April 8, 2026 15:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Comment thread javascript/atoms/typescript/is-displayed.ts
Comment thread javascript/atoms/typescript/is-displayed.ts Outdated
Comment thread javascript/atoms/typescript/is-displayed-global.js Outdated
Comment thread javascript/atoms/typescript/is-displayed-global.js Outdated
Copilot AI review requested due to automatic review settings April 9, 2026 15:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 75 out of 81 changed files in this pull request and generated 5 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment thread javascript/atoms/BUILD.bazel Outdated
Comment thread javascript/atoms/typescript/is-displayed.ts
Comment thread .github/workflows/bazel.yml
Comment thread rust/CHANGELOG.md
Comment thread .github/workflows/release.yml
@AutomatedTester AutomatedTester force-pushed the atoms-ts-isdisplayed branch 2 times, most recently from a6a2ff6 to ad8d8ed Compare April 9, 2026 19:23
Copilot AI review requested due to automatic review settings April 9, 2026 19:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Comment thread javascript/selenium-webdriver/lib/atoms/BUILD.bazel Outdated
Comment thread javascript/atoms/BUILD.bazel Outdated
Comment thread javascript/atoms/typescript/is-displayed.ts
Comment thread javascript/atoms/typescript/is-displayed-global.js Outdated
Copilot AI review requested due to automatic review settings April 18, 2026 11:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Comment thread javascript/atoms/BUILD.bazel Outdated
Comment thread javascript/atoms/typescript/is-displayed-global.js Outdated
AutomatedTester added a commit that referenced this pull request Apr 20, 2026
…ia Bazel

- Fix invalid Bazel label in js_binary: entry_point must not use the
  ':' target prefix when the path contains '/'. Changed
  ':typescript/strip-trailing-semicolon.js' to the file-path form
  'typescript/strip-trailing-semicolon.js'.

- Add wrap-as-global.js Node script that wraps the compiled TypeScript
  atom output with the window.bot.dom.typescript.isShown global
  assignment (plus license header), mirroring the pattern of
  strip-trailing-semicolon.js.

- Add 'wrap_as_global' js_binary and 'is-displayed-global' js_run_binary
  rules so is-displayed-global.js is generated from the same TypeScript
  source rather than being a separate hand-maintained copy that could
  drift.

- Remove the hand-maintained javascript/atoms/typescript/is-displayed-global.js;
  it is now produced by the new Bazel rule.

Fixes review comments in PR #17316.
Copilot AI review requested due to automatic review settings April 21, 2026 16:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Comment thread javascript/atoms/typescript/is-displayed.ts
AutomatedTester added a commit that referenced this pull request Apr 25, 2026
…ia Bazel

- Fix invalid Bazel label in js_binary: entry_point must not use the
  ':' target prefix when the path contains '/'. Changed
  ':typescript/strip-trailing-semicolon.js' to the file-path form
  'typescript/strip-trailing-semicolon.js'.

- Add wrap-as-global.js Node script that wraps the compiled TypeScript
  atom output with the window.bot.dom.typescript.isShown global
  assignment (plus license header), mirroring the pattern of
  strip-trailing-semicolon.js.

- Add 'wrap_as_global' js_binary and 'is-displayed-global' js_run_binary
  rules so is-displayed-global.js is generated from the same TypeScript
  source rather than being a separate hand-maintained copy that could
  drift.

- Remove the hand-maintained javascript/atoms/typescript/is-displayed-global.js;
  it is now produced by the new Bazel rule.

Fixes review comments in PR #17316.
AutomatedTester added a commit that referenced this pull request Apr 25, 2026
Replace all 'instanceof Element' (and related HTMLFormElement,
HTMLMapElement, HTMLAreaElement) checks with nodeType-based checks
so that isShown correctly handles Elements originating from a
different JS realm (e.g., elements from an iframe).

Closes review comment r3118809041 on PR #17316.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 25, 2026 11:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Comment thread javascript/atoms/test/shown_typescript_test.html Outdated
AutomatedTester added a commit that referenced this pull request Apr 25, 2026
Port the getAttribute WebDriver atom from Google Closure
(javascript/webdriver/atoms/attribute.js) to TypeScript following
the pattern established for is-displayed in PR #17316.

Changes:
- javascript/atoms/typescript/get-attribute.ts: TypeScript IIFE
  implementation of the getAttribute atom. Drops IE compatibility
  (IE_DOC_PRE8/PRE9, getAttributeNode quirks), uses nodeType-based
  isElement() for cross-realm safety. Preserves all existing behavior:
  style → cssText, selected/checked state-based, href/src property
  resolution, spellcheck normalisation, boolean property list,
  PROPERTY_ALIASES (class→className, readonly→readOnly).
- javascript/atoms/typescript/strip-trailing-semicolon.js: Node script
  that removes the trailing semicolon tsc adds after the IIFE, so the
  output can be injected as a JS expression.
- javascript/atoms/typescript/wrap-get-attribute-as-global.js: Node
  script that wraps the compiled output as
  window.bot.dom.typescript.getAttribute for use in browser tests.
- javascript/atoms/test/attribute_typescript_test.html: QUnit test page
  for the TypeScript atom covering named attrs, class, missing attrs,
  empty string, boolean attrs, selected/checked state, href/src URL
  resolution, style cssText, spellcheck, case insensitivity, expandos.
- javascript/atoms/BUILD.bazel: Adds js_binary and js_run_binary rules
  to compile TypeScript → strip semicolon → wrap as global; updates
  the atoms filegroup to include .ts sources and the generated global.
- javascript/atoms/fragments/BUILD.bazel: Adds copy_file rule
  get-attribute-typescript exposing the generated JS as a fragment.
- py/BUILD.bazel: Switches the get-attribute copy_file to use
  //javascript/atoms/fragments:get-attribute-typescript.js instead of
  the Closure-compiled fragment.

The old Closure get-attribute fragment is kept unchanged so that Ruby,
Java, .NET, and JavaScript bindings are not affected.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
AutomatedTester added a commit that referenced this pull request Apr 30, 2026
…ia Bazel

- Fix invalid Bazel label in js_binary: entry_point must not use the
  ':' target prefix when the path contains '/'. Changed
  ':typescript/strip-trailing-semicolon.js' to the file-path form
  'typescript/strip-trailing-semicolon.js'.

- Add wrap-as-global.js Node script that wraps the compiled TypeScript
  atom output with the window.bot.dom.typescript.isShown global
  assignment (plus license header), mirroring the pattern of
  strip-trailing-semicolon.js.

- Add 'wrap_as_global' js_binary and 'is-displayed-global' js_run_binary
  rules so is-displayed-global.js is generated from the same TypeScript
  source rather than being a separate hand-maintained copy that could
  drift.

- Remove the hand-maintained javascript/atoms/typescript/is-displayed-global.js;
  it is now produced by the new Bazel rule.

Fixes review comments in PR #17316.
AutomatedTester added a commit that referenced this pull request Apr 30, 2026
Replace all 'instanceof Element' (and related HTMLFormElement,
HTMLMapElement, HTMLAreaElement) checks with nodeType-based checks
so that isShown correctly handles Elements originating from a
different JS realm (e.g., elements from an iframe).

Closes review comment r3118809041 on PR #17316.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 30, 2026 11:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings April 30, 2026 13:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Comment thread javascript/atoms/typescript/is-displayed.ts Outdated
Comment thread javascript/atoms/typescript/is-displayed.ts
Comment thread javascript/atoms/test/html5/shadow_dom_typescript_test.html
AutomatedTester added a commit that referenced this pull request May 7, 2026
Port the getAttribute WebDriver atom from Google Closure
(javascript/webdriver/atoms/attribute.js) to TypeScript following
the pattern established for is-displayed in PR #17316.

Changes:
- javascript/atoms/typescript/get-attribute.ts: TypeScript IIFE
  implementation of the getAttribute atom. Drops IE compatibility
  (IE_DOC_PRE8/PRE9, getAttributeNode quirks), uses nodeType-based
  isElement() for cross-realm safety. Preserves all existing behavior:
  style → cssText, selected/checked state-based, href/src property
  resolution, spellcheck normalisation, boolean property list,
  PROPERTY_ALIASES (class→className, readonly→readOnly).
- javascript/atoms/typescript/strip-trailing-semicolon.js: Node script
  that removes the trailing semicolon tsc adds after the IIFE, so the
  output can be injected as a JS expression.
- javascript/atoms/typescript/wrap-get-attribute-as-global.js: Node
  script that wraps the compiled output as
  window.bot.dom.typescript.getAttribute for use in browser tests.
- javascript/atoms/test/attribute_typescript_test.html: QUnit test page
  for the TypeScript atom covering named attrs, class, missing attrs,
  empty string, boolean attrs, selected/checked state, href/src URL
  resolution, style cssText, spellcheck, case insensitivity, expandos.
- javascript/atoms/BUILD.bazel: Adds js_binary and js_run_binary rules
  to compile TypeScript → strip semicolon → wrap as global; updates
  the atoms filegroup to include .ts sources and the generated global.
- javascript/atoms/fragments/BUILD.bazel: Adds copy_file rule
  get-attribute-typescript exposing the generated JS as a fragment.
- py/BUILD.bazel: Switches the get-attribute copy_file to use
  //javascript/atoms/fragments:get-attribute-typescript.js instead of
  the Closure-compiled fragment.

The old Closure get-attribute fragment is kept unchanged so that Ruby,
Java, .NET, and JavaScript bindings are not affected.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
AutomatedTester added a commit that referenced this pull request May 7, 2026
…ia Bazel

- Fix invalid Bazel label in js_binary: entry_point must not use the
  ':' target prefix when the path contains '/'. Changed
  ':typescript/strip-trailing-semicolon.js' to the file-path form
  'typescript/strip-trailing-semicolon.js'.

- Add wrap-as-global.js Node script that wraps the compiled TypeScript
  atom output with the window.bot.dom.typescript.isShown global
  assignment (plus license header), mirroring the pattern of
  strip-trailing-semicolon.js.

- Add 'wrap_as_global' js_binary and 'is-displayed-global' js_run_binary
  rules so is-displayed-global.js is generated from the same TypeScript
  source rather than being a separate hand-maintained copy that could
  drift.

- Remove the hand-maintained javascript/atoms/typescript/is-displayed-global.js;
  it is now produced by the new Bazel rule.

Fixes review comments in PR #17316.
AutomatedTester added a commit that referenced this pull request May 7, 2026
Replace all 'instanceof Element' (and related HTMLFormElement,
HTMLMapElement, HTMLAreaElement) checks with nodeType-based checks
so that isShown correctly handles Elements originating from a
different JS realm (e.g., elements from an iframe).

Closes review comment r3118809041 on PR #17316.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@AutomatedTester AutomatedTester force-pushed the atoms-ts-isdisplayed branch from 424a8cb to 80409f6 Compare May 7, 2026 12:31
AutomatedTester added a commit that referenced this pull request May 11, 2026
…ia Bazel

- Fix invalid Bazel label in js_binary: entry_point must not use the
  ':' target prefix when the path contains '/'. Changed
  ':typescript/strip-trailing-semicolon.js' to the file-path form
  'typescript/strip-trailing-semicolon.js'.

- Add wrap-as-global.js Node script that wraps the compiled TypeScript
  atom output with the window.bot.dom.typescript.isShown global
  assignment (plus license header), mirroring the pattern of
  strip-trailing-semicolon.js.

- Add 'wrap_as_global' js_binary and 'is-displayed-global' js_run_binary
  rules so is-displayed-global.js is generated from the same TypeScript
  source rather than being a separate hand-maintained copy that could
  drift.

- Remove the hand-maintained javascript/atoms/typescript/is-displayed-global.js;
  it is now produced by the new Bazel rule.

Fixes review comments in PR #17316.
@AutomatedTester AutomatedTester merged commit dfcc86e into trunk May 11, 2026
67 checks passed
@AutomatedTester AutomatedTester deleted the atoms-ts-isdisplayed branch May 11, 2026 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

B-atoms JavaScript chunks generated by Google closure B-build Includes scripting, bazel and CI integrations C-nodejs JavaScript Bindings C-py Python Bindings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants