null computed style to avoid npe
This commit is contained in:
parent
ab2bb869a3
commit
304b0292be
@ -855,15 +855,15 @@
|
|||||||
// If this slide has a background color, add a class that
|
// If this slide has a background color, add a class that
|
||||||
// signals if it is light or dark. If the slide has no background
|
// signals if it is light or dark. If the slide has no background
|
||||||
// color, no class will be set
|
// color, no class will be set
|
||||||
var computedBackgroundColor = window.getComputedStyle( element ).backgroundColor;
|
var computedBackgroundStyle = window.getComputedStyle( element );
|
||||||
if( computedBackgroundColor ) {
|
if( computedBackgroundStyle && computedBackgroundStyle.backgroundColor ) {
|
||||||
var rgb = colorToRgb( computedBackgroundColor );
|
var rgb = colorToRgb( computedBackgroundStyle.backgroundColor );
|
||||||
|
|
||||||
// Ignore fully transparent backgrounds. Some browsers return
|
// Ignore fully transparent backgrounds. Some browsers return
|
||||||
// rgba(0,0,0,0) when reading the computed background color of
|
// rgba(0,0,0,0) when reading the computed background color of
|
||||||
// an element with no background
|
// an element with no background
|
||||||
if( rgb && rgb.a !== 0 ) {
|
if( rgb && rgb.a !== 0 ) {
|
||||||
if( colorBrightness( computedBackgroundColor ) < 128 ) {
|
if( colorBrightness( computedBackgroundStyle.backgroundColor ) < 128 ) {
|
||||||
slide.classList.add( 'has-dark-background' );
|
slide.classList.add( 'has-dark-background' );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user