bitovi / bitovi/jquerypp

range.js initialization in IE 8/9

Open
#99 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.2k
Forks
155
PR merge metrics
No merged PRs in 30d

Description

Line 77 in the `$.Range` constructor is problematic if you've included jquerypp in and there's no DOM yet.

B/c `this.win.document.body` is null, `this.range` doesn't get assigned.

If this.range doesn't get assigned, the module setup (anonymous) function chokes at line 642 ( ... `fn.compare = range.compareBoundaryPoints ?` ...) and bails w/ an exception.

This is especially dangerous if you, like me, happen to have range.js concatenated w/ a bunch of other files (and minified) - those other files' initialization may not run b/c of the exception.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in range.js at line 77 of the $.Range constructor and trace the module setup around line 642. Reproduce loading jquerypp in the document head before a body exists, then verify that range.js no longer throws and that initialization of subsequent concatenated modules still runs.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.