Move custom style
This commit is contained in:
parent
65811a7bfe
commit
b870cbad0f
51
src/util.js
51
src/util.js
@ -174,57 +174,6 @@ var Util = (function UtilClosure() {
|
|||||||
return Util;
|
return Util;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
// optimised CSS custom property getter/setter
|
|
||||||
var CustomStyle = (function CustomStyleClosure() {
|
|
||||||
|
|
||||||
// As noted on: http://www.zachstronaut.com/posts/2009/02/17/
|
|
||||||
// animate-css-transforms-firefox-webkit.html
|
|
||||||
// in some versions of IE9 it is critical that ms appear in this list
|
|
||||||
// before Moz
|
|
||||||
var prefixes = ['ms', 'Moz', 'Webkit', 'O'];
|
|
||||||
var _cache = { };
|
|
||||||
|
|
||||||
function CustomStyle() {
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomStyle.getProp = function get(propName, element) {
|
|
||||||
// check cache only when no element is given
|
|
||||||
if (arguments.length == 1 && typeof _cache[propName] == 'string') {
|
|
||||||
return _cache[propName];
|
|
||||||
}
|
|
||||||
|
|
||||||
element = element || document.documentElement;
|
|
||||||
var style = element.style, prefixed, uPropName;
|
|
||||||
|
|
||||||
// test standard property first
|
|
||||||
if (typeof style[propName] == 'string') {
|
|
||||||
return (_cache[propName] = propName);
|
|
||||||
}
|
|
||||||
|
|
||||||
// capitalize
|
|
||||||
uPropName = propName.charAt(0).toUpperCase() + propName.slice(1);
|
|
||||||
|
|
||||||
// test vendor specific properties
|
|
||||||
for (var i = 0, l = prefixes.length; i < l; i++) {
|
|
||||||
prefixed = prefixes[i] + uPropName;
|
|
||||||
if (typeof style[prefixed] == 'string') {
|
|
||||||
return (_cache[propName] = prefixed);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//if all fails then set to undefined
|
|
||||||
return (_cache[propName] = 'undefined');
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomStyle.setProp = function set(propName, element, str) {
|
|
||||||
var prop = this.getProp(propName);
|
|
||||||
if (prop != 'undefined')
|
|
||||||
element.style[prop] = str;
|
|
||||||
}
|
|
||||||
|
|
||||||
return CustomStyle;
|
|
||||||
})();
|
|
||||||
|
|
||||||
var PDFStringTranslateTable = [
|
var PDFStringTranslateTable = [
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0x2D8, 0x2C7, 0x2C6, 0x2D9, 0x2DD, 0x2DB, 0x2DA, 0x2DC, 0, 0, 0, 0, 0, 0, 0,
|
0x2D8, 0x2C7, 0x2C6, 0x2D9, 0x2DD, 0x2DB, 0x2DA, 0x2DC, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
@ -1022,6 +1022,57 @@ var DocumentOutlineView = function documentOutlineView(outline) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// optimised CSS custom property getter/setter
|
||||||
|
var CustomStyle = (function CustomStyleClosure() {
|
||||||
|
|
||||||
|
// As noted on: http://www.zachstronaut.com/posts/2009/02/17/
|
||||||
|
// animate-css-transforms-firefox-webkit.html
|
||||||
|
// in some versions of IE9 it is critical that ms appear in this list
|
||||||
|
// before Moz
|
||||||
|
var prefixes = ['ms', 'Moz', 'Webkit', 'O'];
|
||||||
|
var _cache = { };
|
||||||
|
|
||||||
|
function CustomStyle() {
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomStyle.getProp = function get(propName, element) {
|
||||||
|
// check cache only when no element is given
|
||||||
|
if (arguments.length == 1 && typeof _cache[propName] == 'string') {
|
||||||
|
return _cache[propName];
|
||||||
|
}
|
||||||
|
|
||||||
|
element = element || document.documentElement;
|
||||||
|
var style = element.style, prefixed, uPropName;
|
||||||
|
|
||||||
|
// test standard property first
|
||||||
|
if (typeof style[propName] == 'string') {
|
||||||
|
return (_cache[propName] = propName);
|
||||||
|
}
|
||||||
|
|
||||||
|
// capitalize
|
||||||
|
uPropName = propName.charAt(0).toUpperCase() + propName.slice(1);
|
||||||
|
|
||||||
|
// test vendor specific properties
|
||||||
|
for (var i = 0, l = prefixes.length; i < l; i++) {
|
||||||
|
prefixed = prefixes[i] + uPropName;
|
||||||
|
if (typeof style[prefixed] == 'string') {
|
||||||
|
return (_cache[propName] = prefixed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//if all fails then set to undefined
|
||||||
|
return (_cache[propName] = 'undefined');
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomStyle.setProp = function set(propName, element, str) {
|
||||||
|
var prop = this.getProp(propName);
|
||||||
|
if (prop != 'undefined')
|
||||||
|
element.style[prop] = str;
|
||||||
|
}
|
||||||
|
|
||||||
|
return CustomStyle;
|
||||||
|
})();
|
||||||
|
|
||||||
var TextLayerBuilder = function textLayerBuilder(textLayerDiv) {
|
var TextLayerBuilder = function textLayerBuilder(textLayerDiv) {
|
||||||
this.textLayerDiv = textLayerDiv;
|
this.textLayerDiv = textLayerDiv;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user