Use dataset setters instead of setAttribute.

This commit is contained in:
Mayhem 2013-07-14 18:51:02 +02:00
parent d252aacf4f
commit ddbec61e1b
8 changed files with 17 additions and 15 deletions

View File

@ -206,7 +206,7 @@ Filter =
el = $.el 'a',
href: 'javascript:;'
textContent: text
el.setAttribute 'data-type', type
el.dataset.type = type
$.on el, 'click', Filter.menu.makeFilter
return {

View File

@ -96,7 +96,7 @@ ThreadHiding =
className: "#{type}-thread-button"
innerHTML: "<span>[&nbsp;#{if type is 'hide' then '-' else '+'}&nbsp;]</span>"
href: 'javascript:;'
a.setAttribute 'data-fullid', thread.fullID
a.dataset.fullid = thread.fullID
$.on a, 'click', ThreadHiding.toggle
a

View File

@ -60,4 +60,4 @@ class Clone extends Post
@isDead = true if origin.isDead
@isClone = true
index = origin.clones.push(@) - 1
root.setAttribute 'data-clone', index
root.dataset.clone = index

View File

@ -140,7 +140,7 @@ Header =
a.textContent
if m = t.match /-(index|catalog)/
a.setAttribute 'data-only', m[1]
a.dataset.only = m[1]
a.href = "//boards.4chan.org/#{board}/"
a.href += 'catalog' if m[1] is 'catalog'

View File

@ -194,5 +194,5 @@ class Post
rmClone: (index) ->
@clones.splice index, 1
for clone in @clones[index..]
clone.nodes.root.setAttribute 'data-clone', index++
clone.nodes.root.dataset.clone = index++
return

View File

@ -458,9 +458,9 @@ Settings =
td.innerHTML = '<select></select>'
select = td.firstElementChild
unless select.disabled = length is 1
# XXX GM can't into datasets
select.setAttribute 'data-boardid', boardID
select.setAttribute 'data-type', type
$.extend select.dataset,
boardid: boardID
type: type
$.on select, 'change', Settings.saveSelectedArchive
$.add select, options
else

View File

@ -13,7 +13,7 @@ ImageHover =
el = $.el 'img',
id: 'ihover'
src: post.file.URL
el.setAttribute 'data-fullid', post.fullID
el.dataset.fullid = post.fullID
$.add d.body, el
UI.hover
root: @

View File

@ -44,9 +44,10 @@ Quotify =
className: 'quotelink deadlink'
target: '_blank'
textContent: "#{quote}\u00A0(Dead)"
a.setAttribute 'data-boardid', boardID
a.setAttribute 'data-threadid', post.thread.ID
a.setAttribute 'data-postid', postID
$.extend a.dataset,
boardid: boardID
threadid: post.thread.ID
postid: postID
else if redirect = Redirect.to 'thread', {boardID, threadID: 0, postID}
# Replace the .deadlink span if we can redirect.
a = $.el 'a',
@ -56,9 +57,10 @@ Quotify =
textContent: "#{quote}\u00A0(Dead)"
if Redirect.to 'post', {boardID, postID}
# Make it function as a normal quote if we can fetch the post.
$.addClass a, 'quotelink'
a.setAttribute 'data-boardid', boardID
a.setAttribute 'data-postid', postID
$.addClass a, 'quotelink'
$.extend a.dataset,
boardid: boardID
postid: postID
unless quoteID in @quotes
@quotes.push quoteID