Skip to content

Commit

Permalink
Fix Issue #7
Browse files Browse the repository at this point in the history
  • Loading branch information
John Glynn committed Jun 20, 2018
1 parent b771fbb commit 6901e7b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ ___

* **marginLeft**: [type: string / null] [default: null]

If the target table contains an explicit margin-left CSS rule, the same value must be used in this attribute (for example: "auto", "20%", "10px"). The reason why it is needed it is because most browsers (all except of IE) don’t allow direct access to the current CSS rule applied to an element in its original units (such as "%", "em" or "auto" values).
If the target table contains an explicit margin-left CSS rule, the same value must be used in this attribute (for example: "auto", "20%", "10px"). The reason why it is needed it is because most browsers (all except of legacy IE) don’t allow direct access to the current CSS rule applied to an element in its original units (such as "%", "em" or "auto" values).
___

* **marginRight**: [type: string / null] [default: null]
Expand Down
10 changes: 7 additions & 3 deletions src/ColumnResizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default class ColumnResizer {
PX = 'px';
RESIZABLE = 'grip-resizable';
FLEX = 'grip-flex';
IE = navigator.userAgent.indexOf('Trident/4.0') > 0;
legacyIE = navigator.userAgent.indexOf('Trident/4.0') > 0;

/**
*
Expand All @@ -31,6 +31,10 @@ export default class ColumnResizer {
this.grip = null;
this.tb = tb;
window.addEventListener('resize', this.onResize);
// Polyfill for IE
if (!Element.prototype.matches) {
Element.prototype.matches = Element.prototype.msMatchesSelector;
}
this.init(options);
}

Expand Down Expand Up @@ -411,8 +415,8 @@ export default class ColumnResizer {
if (tb.opt.marginRight) {
tb.gripContainer.style.marginRight = tb.opt.marginRight;
}
tb.cellSpace = parseInt(this.IE ? tb.cellSpacing || tb.currentStyle.borderSpacing : window.getComputedStyle(tb).borderSpacing.split(' ')[0].replace(/px/, '')) || 2;
tb.borderSpace = parseInt(this.IE ? tb.border || tb.currentStyle.borderLeftWidth : window.getComputedStyle(tb).borderLeftWidth.replace(/px/, '')) || 1;
tb.cellSpace = parseInt(this.legacyIE ? tb.cellSpacing || tb.currentStyle.borderSpacing : window.getComputedStyle(tb).borderSpacing.split(' ')[0].replace(/px/, '')) || 2;
tb.borderSpace = parseInt(this.legacyIE ? tb.border || tb.currentStyle.borderLeftWidth : window.getComputedStyle(tb).borderLeftWidth.replace(/px/, '')) || 1;
tb.extended = true;
this.createGrips(th);
};
Expand Down

0 comments on commit 6901e7b

Please sign in to comment.