mirror of
https://github.com/moodle/moodle.git
synced 2025-07-24 15:51:56 +02:00
MDL-36609 javascript: ensure HTML element exists before attempting to perform JS functionality
This commit is contained in:
@@ -340,11 +340,16 @@ M.util.init_maximised_embed = function(Y, id) {
|
|||||||
if (Y.Lang.isString(el)) {
|
if (Y.Lang.isString(el)) {
|
||||||
el = Y.one('#' + el);
|
el = Y.one('#' + el);
|
||||||
}
|
}
|
||||||
var val = el.getStyle(prop);
|
// Ensure element exists.
|
||||||
if (val == 'auto') {
|
if (el) {
|
||||||
val = el.getComputedStyle(prop);
|
var val = el.getStyle(prop);
|
||||||
|
if (val == 'auto') {
|
||||||
|
val = el.getComputedStyle(prop);
|
||||||
|
}
|
||||||
|
return parseInt(val);
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
return parseInt(val);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var resize_object = function() {
|
var resize_object = function() {
|
||||||
|
Reference in New Issue
Block a user