mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-13 08:44:12 +03:00
Make $.fn.document
always take event name / doc string args
It's simpler and we don't use the other syntax right now.
This commit is contained in:
parent
25839c5cf5
commit
634117ed66
@ -42,7 +42,7 @@ describe 'jQuery extensions', ->
|
||||
element.trigger 'foo'
|
||||
expect(events).toEqual [2,1,3]
|
||||
|
||||
describe "$.fn.events() and $.fn.document", ->
|
||||
describe "$.fn.events() and $.fn.document(...)", ->
|
||||
it "returns a list of all events being listened for on the target node or its ancestors, along with their documentation string", ->
|
||||
view = $$ ->
|
||||
@div id: 'a', =>
|
||||
@ -50,20 +50,18 @@ describe 'jQuery extensions', ->
|
||||
@div id: 'c'
|
||||
@div id: 'd'
|
||||
|
||||
view.document
|
||||
'a1': "This is event A2"
|
||||
'b2': "This is event b2"
|
||||
view.document 'a1', "This is event A2"
|
||||
view.document 'b2', "This is event b2"
|
||||
|
||||
view.document 'a1': "A1: Waste perfectly-good steak"
|
||||
view.document 'a1', "A1: Waste perfectly-good steak"
|
||||
view.on 'a1', ->
|
||||
view.on 'a2', ->
|
||||
view.on 'b1', -> # should not appear as a duplicate
|
||||
|
||||
divB = view.find('#b')
|
||||
|
||||
divB.document
|
||||
'b1': "B1: Super-sonic bomber"
|
||||
'b2': "B2: Looks evil. Kinda is."
|
||||
divB.document 'b1', "B1: Super-sonic bomber"
|
||||
divB.document 'b2', "B2: Looks evil. Kinda is."
|
||||
divB.on 'b1', ->
|
||||
divB.on 'b2', ->
|
||||
|
||||
|
@ -59,12 +59,9 @@ $.fn.trueHeight = ->
|
||||
$.fn.trueWidth = ->
|
||||
this[0].getBoundingClientRect().width
|
||||
|
||||
$.fn.document = (eventDescriptions, optionalDoc) ->
|
||||
if optionalDoc
|
||||
eventName = eventDescriptions
|
||||
eventDescriptions = {}
|
||||
eventDescriptions[eventName] = optionalDoc
|
||||
|
||||
$.fn.document = (eventName, docString) ->
|
||||
eventDescriptions = {}
|
||||
eventDescriptions[eventName] = docString
|
||||
@data('documentation', {}) unless @data('documentation')
|
||||
_.extend(@data('documentation'), eventDescriptions)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user