|
|
@ -1,9 +1,10 @@ |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 对DOM操作的通用函数 |
|
|
|
* 对DOM操作的通用函数 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
import { Widget } from "../4.widget" |
|
|
|
import { Widget } from "../4.widget"; |
|
|
|
import { each, isEmpty, isNull, isNotNull } from "../2.base"; |
|
|
|
import { each, isEmpty, isNull, isNotNull } from "../2.base"; |
|
|
|
import $ from "jquery"; |
|
|
|
import $ from "jquery"; |
|
|
|
|
|
|
|
import { isIE } from "./../platform"; |
|
|
|
|
|
|
|
|
|
|
|
export function ready(fn) { |
|
|
|
export function ready(fn) { |
|
|
|
Widget._renderEngine.createElement(document).ready(fn); |
|
|
|
Widget._renderEngine.createElement(document).ready(fn); |
|
|
@ -65,10 +66,10 @@ export function preloadImages(srcArray, onload) { |
|
|
|
each(srcArray, (i, src) => { |
|
|
|
each(srcArray, (i, src) => { |
|
|
|
images[i] = new Image(); |
|
|
|
images[i] = new Image(); |
|
|
|
images[i].src = src; |
|
|
|
images[i].src = src; |
|
|
|
images[i].onload = function () { |
|
|
|
images[i].onload = function() { |
|
|
|
complete(); |
|
|
|
complete(); |
|
|
|
}; |
|
|
|
}; |
|
|
|
images[i].onerror = function () { |
|
|
|
images[i].onerror = function() { |
|
|
|
complete(); |
|
|
|
complete(); |
|
|
|
}; |
|
|
|
}; |
|
|
|
}); |
|
|
|
}); |
|
|
@ -751,7 +752,7 @@ export function getComboPosition(combo, popup, extraWidth, extraHeight, needAdap |
|
|
|
* 获取position:fixed相对定位的元素 |
|
|
|
* 获取position:fixed相对定位的元素 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
export function getPositionRelativeContainingBlock(element) { |
|
|
|
export function getPositionRelativeContainingBlock(element) { |
|
|
|
if (["html", "body", "#document"].indexOf((element.nodeName || "").toLowerCase()) >= 0) { |
|
|
|
if (isIE() || ["html", "body", "#document"].indexOf((element.nodeName || "").toLowerCase()) >= 0) { |
|
|
|
// $FlowFixMe[incompatible-return]: assume body is always available
|
|
|
|
// $FlowFixMe[incompatible-return]: assume body is always available
|
|
|
|
return element.ownerDocument.body; |
|
|
|
return element.ownerDocument.body; |
|
|
|
} |
|
|
|
} |
|
|
|