Skip to content
This repository was archived by the owner on Jul 25, 2019. It is now read-only.

Commit a07db93

Browse files
committed
remove support for IE7; prune IE7-specific shims from code
1 parent 07b36e2 commit a07db93

File tree

13 files changed

+40
-87
lines changed

13 files changed

+40
-87
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Handsontable is a minimalistic approach to Excel-like table editor in HTML & jQuery. Requires jQuery 1.9+ or 2.0+ (may work with 1.7+ too, but there are known issues with [IE10](https://github.com/warpech/jquery-handsontable/issues/410)).
44

5-
Runs in IE7, IE8, IE9, IE10, Firefox, Chrome, Safari and Opera.
5+
Runs in IE8, IE9, IE10, Firefox, Chrome, Safari and Opera.
66

77
See the demos at http://handsontable.com/ or fork the example on [JSFiddle](http://jsfiddle.net/warpech/hU6Kz/).
88

demo/js/samples.js

-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
}
3131

3232
$(function () {
33-
//if (!$.browser.msie || parseInt($.browser.version, 10) > 6) { //syntax coloring does not work well with IE7
3433
$('.descLayout pre.javascript code').each(function () {
3534
var $script = $(this);
3635
var code = trimCodeBlock($script[0].innerHTML);
@@ -48,7 +47,6 @@
4847
$pre.insertAfter($script);
4948
});
5049
hljs.initHighlighting();
51-
//}
5250

5351
//http://stackoverflow.com/questions/2419749/get-selected-elements-outer-html
5452
jQuery.fn.outerHTML = function (s) {

src/3rdparty/walkontable/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This is a playground for next table view engine that will enable virtual rendering in [Handsontable](http://handsontable.com/).
44

5-
Works in IE7+, FF3.6+, latest Opera, Safari and Chrome.
5+
Works in IE8+, FF3.6+, latest Opera, Safari and Chrome.
66

77
Built with almost full TDD test coverage (Jasmine).
88

src/3rdparty/walkontable/src/dom.js

+3-15
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ if (document.createTextNode('test').textContent) { //STANDARDS
190190
}
191191
};
192192
}
193-
else { //IE7-8
193+
else { //IE8
194194
WalkontableDom.prototype.fastInnerText = function (element, content) {
195195
var child = element.firstChild;
196196
if (child && child.nodeType === 3 && child.nextSibling === null) {
@@ -219,7 +219,7 @@ WalkontableDom.prototype.isVisible = function (elem) {
219219
}
220220
}
221221
catch (e) {
222-
return false; //IE7-8 throws "Unspecified error" when offsetParent is not found - we catch it here
222+
return false; //IE8 throws "Unspecified error" when offsetParent is not found - we catch it here
223223
}
224224

225225
// if (elem.offsetWidth > 0 || (elem.parentNode && elem.parentNode.offsetWidth > 0)) { //IE10 was mistaken here
@@ -234,23 +234,11 @@ WalkontableDom.prototype.isVisible = function (elem) {
234234
return false;
235235
}
236236
else if (next.nodeType === 11) {
237-
if (next.nodeName === '#document-fragment') { //Shadow DOM
238-
return (true);
239-
}
240-
else { //IE7 reports nodeType === 11 after detaching element from DOM
241-
return (false);
242-
}
237+
return true;
243238
}
244239
else if (next.style.display === 'none') {
245240
return false;
246241
}
247-
/*else if (next !== elem && next.offsetWidth === 0) {
248-
//this is the technique used by jQuery is(':visible')
249-
//but in IE7, clientWidth & offsetWidth sometimes returns 0 when it shouldn't
250-
return false;
251-
252-
compare with jQuery :visible selector (search jquery.js for `reliableHiddenOffsets`)
253-
}*/
254242
next = next.parentNode;
255243
}
256244
return true;

src/3rdparty/walkontable/src/table.js

-13
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@ function WalkontableTable(instance) {
1212
this.wtDom = this.instance.wtDom;
1313
this.wtDom.removeTextNodes(this.TABLE);
1414

15-
this.hasEmptyCellProblem = ($.browser.msie && (parseInt($.browser.version, 10) <= 7));
16-
this.hasCellSpacingProblem = ($.browser.msie && (parseInt($.browser.version, 10) <= 7));
17-
18-
if (this.hasCellSpacingProblem) { //IE7
19-
this.TABLE.cellSpacing = 0;
20-
}
21-
2215
//wtSpreader
2316
var parent = this.TABLE.parentNode;
2417
if (!parent || parent.nodeType !== 1 || !this.wtDom.hasClass(parent, 'wtHolder')) {
@@ -240,9 +233,6 @@ WalkontableTable.prototype.adjustAvailableNodes = function () {
240233
TD = TR.firstChild; //actually it is TH but let's reuse single variable
241234
for (c = 0; c < displayThs; c++) {
242235
rowHeaders[c](-displayThs + c, TD);
243-
if (this.hasEmptyCellProblem) { //IE7
244-
TD.innerHTML = '&nbsp;';
245-
}
246236
TD = TD.nextSibling;
247237
}
248238
}
@@ -382,9 +372,6 @@ WalkontableTable.prototype._doDraw = function () {
382372
TD.className = '';
383373
TD.removeAttribute('style');
384374
this.instance.getSetting('cellRenderer', source_r, source_c, TD);
385-
if (this.hasEmptyCellProblem && TD.innerHTML === '') { //IE7
386-
TD.innerHTML = '&nbsp;';
387-
}
388375
}
389376

390377
offsetRow = this.instance.getSetting('offsetRow'); //refresh the value

src/3rdparty/walkontable/src/wheel.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ function WalkontableWheel(instance) {
44
}
55

66
$(instance.wtTable.TABLE).on('mousewheel', function (event, delta, deltaX, deltaY) {
7-
if (!deltaX && !deltaY && delta) { //we are in IE7-8, see https://github.com/brandonaaron/jquery-mousewheel/issues/53
7+
if (!deltaX && !deltaY && delta) { //we are in IE8, see https://github.com/brandonaaron/jquery-mousewheel/issues/53
88
deltaY = delta;
99
}
1010

src/3rdparty/walkontable/test/jasmine/spec/table.spec.js

+19-19
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ describe('WalkontableTable', function () {
339339
});
340340

341341
it("should remove rows if they were removed in data source", function () {
342-
this.data.splice(8, this.data.length - 8); //second param is required by IE7-8
342+
this.data.splice(8, this.data.length - 8); //second param is required by IE8
343343

344344
var wt = new Walkontable({
345345
table: $table[0],
@@ -353,7 +353,7 @@ describe('WalkontableTable', function () {
353353
wt.draw();
354354
expect($table.find('tbody tr').length).toBe(8);
355355

356-
this.data.splice(7, this.data.length - 7); //second param is required by IE7-8
356+
this.data.splice(7, this.data.length - 7); //second param is required by IE8
357357
wt.draw();
358358
expect($table.find('tbody tr').length).toBe(7);
359359
});
@@ -415,7 +415,7 @@ describe('WalkontableTable', function () {
415415
});
416416

417417
it("should render all rows if height is null", function () {
418-
this.data.splice(20, this.data.length - 20); //second param is required by IE7-8
418+
this.data.splice(20, this.data.length - 20); //second param is required by IE8
419419

420420
var wt = new Walkontable({
421421
table: $table[0],
@@ -509,10 +509,10 @@ describe('WalkontableTable', function () {
509509
}
510510
});
511511
wt.draw();
512-
expect($table.find('tbody tr:first td:eq(0)').outerWidth()).toBeInArray([48, 50]); //IE7 reports 48, other browsers report 50
513-
expect($table.find('tbody tr:first td:eq(1)').outerWidth()).toBeInArray([98, 100]); //IE7 reports 98, other browsers report 100
514-
expect($table.find('tbody tr:first td:eq(2)').outerWidth()).toBeInArray([148, 150]); //IE7 reports 148, other browsers report 150
515-
expect($table.find('tbody tr:first td:eq(3)').outerWidth()).toBeInArray([198, 200]); //IE7 reports 198, other browsers report 200
512+
expect($table.find('tbody tr:first td:eq(0)').outerWidth()).toBe(50);
513+
expect($table.find('tbody tr:first td:eq(1)').outerWidth()).toBe(100);
514+
expect($table.find('tbody tr:first td:eq(2)').outerWidth()).toBe(150);
515+
expect($table.find('tbody tr:first td:eq(3)').outerWidth()).toBe(200);
516516
});
517517

518518
it("should use column width array to get column width", function () {
@@ -533,10 +533,10 @@ describe('WalkontableTable', function () {
533533
columnWidth: [50, 100, 150, 200]
534534
});
535535
wt.draw();
536-
expect($table.find('tbody tr:first td:eq(0)').outerWidth()).toBeInArray([48, 50]); //IE7 reports 48, other browsers report 50
537-
expect($table.find('tbody tr:first td:eq(1)').outerWidth()).toBeInArray([98, 100]); //IE7 reports 98, other browsers report 100
538-
expect($table.find('tbody tr:first td:eq(2)').outerWidth()).toBeInArray([148, 150]); //IE7 reports 148, other browsers report 150
539-
expect($table.find('tbody tr:first td:eq(3)').outerWidth()).toBeInArray([198, 200]); //IE7 reports 198, other browsers report 200
536+
expect($table.find('tbody tr:first td:eq(0)').outerWidth()).toBe(50);
537+
expect($table.find('tbody tr:first td:eq(1)').outerWidth()).toBe(100);
538+
expect($table.find('tbody tr:first td:eq(2)').outerWidth()).toBe(150);
539+
expect($table.find('tbody tr:first td:eq(3)').outerWidth()).toBe(200);
540540
});
541541

542542
it("should use column width integer to get column width", function () {
@@ -557,10 +557,10 @@ describe('WalkontableTable', function () {
557557
columnWidth: 100
558558
});
559559
wt.draw();
560-
expect($table.find('tbody tr:first td:eq(0)').outerWidth()).toBeInArray([98, 100]); //IE7 reports 98, other browsers report 100
561-
expect($table.find('tbody tr:first td:eq(1)').outerWidth()).toBeInArray([98, 100]); //IE7 reports 98, other browsers report 100
562-
expect($table.find('tbody tr:first td:eq(2)').outerWidth()).toBeInArray([98, 100]); //IE7 reports 98, other browsers report 100
563-
expect($table.find('tbody tr:first td:eq(3)').outerWidth()).toBeInArray([98, 100]); //IE7 reports 98, other browsers report 100
560+
expect($table.find('tbody tr:first td:eq(0)').outerWidth()).toBe(100);
561+
expect($table.find('tbody tr:first td:eq(1)').outerWidth()).toBe(100);
562+
expect($table.find('tbody tr:first td:eq(2)').outerWidth()).toBe(100);
563+
expect($table.find('tbody tr:first td:eq(3)').outerWidth()).toBe(100);
564564
});
565565

566566
it("should use column width also when there are no rows", function () {
@@ -584,10 +584,10 @@ describe('WalkontableTable', function () {
584584
});
585585
wt.draw();
586586
//start from eq(1) because eq(0) is corner header
587-
expect($table.find('thead tr:first th:eq(1)').outerWidth()).toBeInArray([98, 100]); //IE7 reports 98, other browsers report 100
588-
expect($table.find('thead tr:first th:eq(2)').outerWidth()).toBeInArray([98, 100]); //IE7 reports 98, other browsers report 100
589-
expect($table.find('thead tr:first th:eq(3)').outerWidth()).toBeInArray([98, 100]); //IE7 reports 98, other browsers report 100
590-
expect($table.find('thead tr:first th:eq(4)').outerWidth()).toBeInArray([98, 100]); //IE7 reports 98, other browsers report 100
587+
expect($table.find('thead tr:first th:eq(1)').outerWidth()).toBe(100);
588+
expect($table.find('thead tr:first th:eq(2)').outerWidth()).toBe(100);
589+
expect($table.find('thead tr:first th:eq(3)').outerWidth()).toBe(100);
590+
expect($table.find('thead tr:first th:eq(4)').outerWidth()).toBe(100);
591591
});
592592

593593
it("should not render a cell that is outside of the viewport horizontally", function () {

src/editors/handsontableEditor.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ HandsontableHandsontableEditorClass.prototype.finishEditing = function (isCancel
7979
if (Handsontable.helper.isDescendant(this.instance.rootElement[0], document.activeElement)) {
8080
var that = this;
8181
setTimeout(function () {
82-
that.instance.listen(); //return the focus to the cell must be done after destroyer to work in IE7-9
82+
that.instance.listen(); //return the focus to the cell must be done after destroyer to work in IE8-9
8383
}, 0);
8484
that.instance.listen(); //return the focus to the cell
8585
}

src/plugins/observeChanges.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ function HandsontableObserveChanges() {
136136
window.addEventListener('mouseup', fastCheck);
137137
window.addEventListener('keydown', fastCheck);
138138
} else {
139-
//IE7 has different syntax
139+
//IE8 has different syntax
140140
window.attachEvent('onmousedown', fastCheck);
141141
window.attachEvent('onmouseup', fastCheck);
142142
window.attachEvent('onkeydown', fastCheck);

src/tableView.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ Handsontable.TableView = function (instance) {
222222
that.settings.afterOnCellMouseDown.call(instance, event, coords, TD);
223223
}
224224
setTimeout(function () {
225-
instance.listen(); //fix IE7-8 bug that sets focus to TD after mousedown
225+
instance.listen(); //fix IE8 bug that sets focus to TD after mousedown
226226
});
227227
},
228228
onCellMouseOver: function (event, coords/*, TD*/) {

test/jasmine/spec/Core_alterSpec.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ describe('Core_alter', function () {
259259
expect(countRows()).toEqual(6);
260260
expect(this.$container.find('tr:eq(4) td:eq(0)').html()).toEqual('e1');
261261

262-
expect(this.$container.find('tr:last td:eq(0)').html()).toEqual(emptyCell());
262+
expect(this.$container.find('tr:last td:eq(0)').html()).toEqual('');
263263
});
264264

265265
it('should insert the amount of rows at given index', function () {
@@ -276,7 +276,7 @@ describe('Core_alter', function () {
276276

277277
expect(countRows()).toEqual(8);
278278

279-
expect(this.$container.find('tr:eq(1) td:eq(0)').html()).toEqual(emptyCell());
279+
expect(this.$container.find('tr:eq(1) td:eq(0)').html()).toEqual('');
280280

281281
expect(this.$container.find('tr:eq(4) td:eq(0)').html()).toEqual('b1');
282282
});
@@ -296,9 +296,9 @@ describe('Core_alter', function () {
296296
expect(countRows()).toEqual(8);
297297
expect(this.$container.find('tr:eq(4) td:eq(0)').html()).toEqual('e1');
298298

299-
expect(this.$container.find('tr:eq(5) td:eq(0)').html()).toEqual(emptyCell());
300-
expect(this.$container.find('tr:eq(6) td:eq(0)').html()).toEqual(emptyCell());
301-
expect(this.$container.find('tr:eq(7) td:eq(0)').html()).toEqual(emptyCell());
299+
expect(this.$container.find('tr:eq(5) td:eq(0)').html()).toEqual('');
300+
expect(this.$container.find('tr:eq(6) td:eq(0)').html()).toEqual('');
301+
expect(this.$container.find('tr:eq(7) td:eq(0)').html()).toEqual('');
302302
});
303303

304304
it('should insert not more rows than maxRows', function () {
@@ -383,9 +383,9 @@ describe('Core_alter', function () {
383383
expect(countCols()).toEqual(11);
384384
expect(this.$container.find('tr:eq(1) td:eq(7)').html()).toEqual('h');
385385

386-
expect(this.$container.find('tr:eq(1) td:eq(8)').html()).toEqual(emptyCell());
387-
expect(this.$container.find('tr:eq(1) td:eq(9)').html()).toEqual(emptyCell());
388-
expect(this.$container.find('tr:eq(1) td:eq(10)').html()).toEqual(emptyCell());
386+
expect(this.$container.find('tr:eq(1) td:eq(8)').html()).toEqual('');
387+
expect(this.$container.find('tr:eq(1) td:eq(9)').html()).toEqual('');
388+
expect(this.$container.find('tr:eq(1) td:eq(10)').html()).toEqual('');
389389
});
390390

391391
it('should insert not more cols than maxCols', function () {
@@ -411,8 +411,8 @@ describe('Core_alter', function () {
411411
alter('insert_col', 1, 10);
412412

413413
expect(countCols()).toEqual(10);
414-
expect(this.$container.find('tr:eq(1) td:eq(1)').html()).toEqual(emptyCell());
415-
expect(this.$container.find('tr:eq(1) td:eq(2)').html()).toEqual(emptyCell());
414+
expect(this.$container.find('tr:eq(1) td:eq(1)').html()).toEqual('');
415+
expect(this.$container.find('tr:eq(1) td:eq(2)').html()).toEqual('');
416416
expect(this.$container.find('tr:eq(1) td:eq(3)').html()).toEqual('b');
417417
});
418418

test/jasmine/spec/SpecHelper.js

-12
Original file line numberDiff line numberDiff line change
@@ -243,15 +243,3 @@ function createSpreadsheetData(rowCount, colCount) {
243243
}
244244
return rows;
245245
}
246-
247-
function runningIE7OrEarlier(){
248-
return $.browser.msie && parseInt($.browser.version) < 8;
249-
}
250-
251-
/**
252-
* Returns value that should be returned when retrieving data from empty cell.
253-
* The value varies depending on browser (IE7 hacks)
254-
*/
255-
function emptyCell() {
256-
return runningIE7OrEarlier() ? '&nbsp;' : '';
257-
}

test/jasmine/spec/renderers/textRendererSpec.js

+2-10
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,15 @@ describe('TextRenderer', function () {
4444
handsontable();
4545
setDataAtCell(2, 2, null);
4646

47-
if(runningIE7OrEarlier()){
48-
expect(getCell(2, 2).innerHTML).toEqual("&nbsp;");
49-
} else {
50-
expect(getCell(2, 2).innerHTML).toEqual("");
51-
}
47+
expect(getCell(2, 2).innerHTML).toEqual('');
5248
});
5349

5450
it('should render undefined', function () {
5551
handsontable();
5652
setDataAtCell(2, 2, (function () {
5753
})());
5854

59-
if(runningIE7OrEarlier()){
60-
expect(getCell(2, 2).innerHTML).toEqual("&nbsp;");
61-
} else {
62-
expect(getCell(2, 2).innerHTML).toEqual("");
63-
}
55+
expect(getCell(2, 2).innerHTML).toEqual('');
6456
});
6557

6658
it('should add class name `htDimmed` to a read only cell', function () {

0 commit comments

Comments
 (0)