Set style properties to empty string to clear them, not null. #544

This commit is contained in:
ccd0 2016-09-10 21:06:21 -07:00
parent 394812b2df
commit de0d779029
6 changed files with 14 additions and 14 deletions

View File

@ -267,7 +267,7 @@ drag = (e) ->
left = if left < 10
0
else if @width - left < 10
null
''
else
left / @screenWidth * 100 + '%'
@ -275,19 +275,19 @@ drag = (e) ->
top = if top < (10 + @topBorder)
@topBorder + 'px'
else if @height - top < (10 + @bottomBorder)
null
''
else
top / @screenHeight * 100 + '%'
right = if left is null
right = if left is ''
0
else
null
''
bottom = if top is null
bottom = if top is ''
@bottomBorder + 'px'
else
null
''
{style} = @
style.left = left
@ -356,9 +356,9 @@ hover = (e) ->
threshold = @clientWidth / 2
threshold = Math.max threshold, @clientWidth - 400 unless @isImage
[left, right] = if clientX <= threshold
[clientX + 45 + 'px', null]
[clientX + 45 + 'px', '']
else
[null, @clientWidth - clientX + 45 + 'px']
['', @clientWidth - clientX + 45 + 'px']
{style} = @
style.top = top + 'px'

View File

@ -329,7 +329,7 @@ Gallery =
style.minHeight = minHeight + 'px'
style.minWidth = (width / height * minHeight) + 'px'
else
style.minHeight = style.minWidth = null
style.minHeight = style.minWidth = ''
setDelay: -> Gallery.delay = +@value

View File

@ -74,6 +74,6 @@ Nav =
if extra > 0
d.body.style.marginBottom = "#{extra}px"
else
d.body.style.marginBottom = null
d.body.style.marginBottom = ''
delete Nav.haveExtra
$.off d, 'scroll', Nav.removeExtra

View File

@ -135,7 +135,7 @@ Captcha.v1 =
QR.captcha.load()
if QR.nodes.el.getBoundingClientRect().bottom > doc.clientHeight
QR.nodes.el.style.top = null
QR.nodes.el.style.top = ''
QR.nodes.el.style.bottom = '0px'
destroy: ->

View File

@ -144,7 +144,7 @@ Captcha.v2 =
fixQRPosition: ->
if QR.nodes.el.getBoundingClientRect().bottom > doc.clientHeight
QR.nodes.el.style.top = null
QR.nodes.el.style.top = ''
QR.nodes.el.style.bottom = '0px'
setupTextArea: (textarea) ->

View File

@ -203,7 +203,7 @@ QR.post = class
@showFileData()
else
@updateFilename()
@nodes.el.style.backgroundImage = null
@nodes.el.style.backgroundImage = ''
unless @file.type in QR.mimeTypes
@fileError 'Unsupported file type.'
else if /^(image|video)\//.test @file.type
@ -299,7 +299,7 @@ QR.post = class
delete @filesize
@nodes.el.removeAttribute 'title'
QR.nodes.filename.removeAttribute 'title'
@nodes.el.style.backgroundImage = null
@nodes.el.style.backgroundImage = ''
$.rmClass @nodes.el, 'has-file'
@showFileData()
URL.revokeObjectURL @URL