Skip to content

Commit d725ac2

Browse files
committed
Merge remote-tracking branch 'twitter/master' into poveropt
Conflicts: js/bootstrap-popover.js
2 parents 4d2e32e + b15e24e commit d725ac2

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

docs/javascript.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ <h3>Options</h3>
683683
<td>content</td>
684684
<td>string, function</td>
685685
<td>'data-content'</td>
686-
<td>a string or method for retrieving content text. if none are provided, content will be sourced from a data-content attribute.</td>
686+
<td>attribute or method for retrieving content text.</td>
687687
</tr>
688688
<tr>
689689
<td>trigger</td>

js/bootstrap-popover.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,11 @@
5151
, o = this.options
5252

5353
if (typeof this.options.content == 'string') {
54-
content = this.options.content
54+
content = $e.attr(this.options.content)
5555
} else if (typeof this.options.content == 'function') {
5656
content = this.options.content.call(this.$element[0])
5757
}
58+
5859
return content
5960
}
6061

@@ -80,9 +81,12 @@
8081

8182
$.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, {
8283
placement: 'right'
84+
, content: 'data-content'
8385
, template: '<div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div>'
8486
, titleSelector: '.title'
8587
, contentSelector: '.content p'
8688
})
8789

90+
$.fn.twipsy.rejectAttrOptions.push( 'content' )
91+
8892
}( window.jQuery || window.ender );

js/bootstrap-twipsy.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,18 @@
305305
, contentSelector: '.twipsy-inner'
306306
}
307307

308+
$.fn.twipsy.rejectAttrOptions = [ 'title' ]
309+
308310
$.fn.twipsy.elementOptions = function(ele, options) {
309-
return $.extend({}, options, $(ele).data())
311+
var data = $(ele).data()
312+
, rejects = $.fn.twipsy.rejectAttrOptions
313+
, i = rejects.length
314+
315+
while (i--) {
316+
delete data[rejects[i]]
317+
}
318+
319+
return $.extend({}, options, data)
310320
}
311321

312322
}( window.jQuery || window.ender );

0 commit comments

Comments
 (0)