cemerick / jsdifflib

A javascript library for diffing text and generating corresponding HTML views

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

babel error - diffview.js

mglazer-cengage opened this issue · comments

ReferenceError: Strict mode forbids implicit creation of global property 'diffview'

Can you please add a 'var' declaration on line 30 of diffview.js?

var diffview = {

Please merge PR #22

i know this is old, but wanted to point out that this change breaks client code (shamefully, mine) which loads diffview.js/difflib.js dynamically via eval and expects diffview/difflib to be declared globally after those scripts are loaded. (Granted, the use of eval in the first place was not my best idea ever, but i'm hesitant to go back and patch otherwise unmaintained trees for this.) A different, backwards-compatible approach would have been:

window.diffview = {...}

And likewise for difflib. That approach is semantically identical to the older approach, but is not in violation of strict mode.

Not a big deal, just pointing it out.