Skip to content

fix(player): fix operator precedence confusion in fullscreen checks#9192

Open
xxiaoxiong wants to merge 1 commit into
videojs:mainfrom
xxiaoxiong:fix/fullscreen-operator-precedence-9182
Open

fix(player): fix operator precedence confusion in fullscreen checks#9192
xxiaoxiong wants to merge 1 commit into
videojs:mainfrom
xxiaoxiong:fix/fullscreen-operator-precedence-9182

Conversation

@xxiaoxiong
Copy link
Copy Markdown

Fixes #9182

Description

Replace !this.options_.preferFullWindow === true with this.options_.preferFullWindow !== true in two locations (requestFullscreenHelper_ and exitFullscreenHelper_) to fix operator precedence confusion.

The ! operator has higher precedence than ===, so the original expression was parsed as (!this.options_.preferFullWindow) === true, which produces the same result for boolean values but is confusing and error-prone.

Changes

  • src/js/player.js: Lines 3038, 3096

Fixes videojs#9182

Replace  with
 to avoid operator precedence
confusion. The  operator has higher precedence than , so the
original expression was parsed as ,
which works for booleans but is error-prone.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Operator precedence confusion in fullscreen checks

1 participant