File tree Expand file tree Collapse file tree 2 files changed +29
-8
lines changed Expand file tree Collapse file tree 2 files changed +29
-8
lines changed Original file line number Diff line number Diff line change @@ -100,6 +100,30 @@ test( "content: string", function() {
100
100
} ) . tooltip ( "open" ) ;
101
101
} ) ;
102
102
103
+ test ( "content: element" , function ( ) {
104
+ expect ( 1 ) ;
105
+ var content = "<p>this is a <i>test</i> of the emergency broadcast system.</p>" ,
106
+ element = $ ( content ) [ 0 ] ;
107
+ $ ( "#tooltipped1" ) . tooltip ( {
108
+ content : element ,
109
+ open : function ( event , ui ) {
110
+ equal ( ui . tooltip . children ( ) . html ( ) . toLowerCase ( ) , content ) ;
111
+ }
112
+ } ) . tooltip ( "open" ) ;
113
+ } ) ;
114
+
115
+ test ( "content: jQuery" , function ( ) {
116
+ expect ( 1 ) ;
117
+ var content = "<p>this is a <i>test</i> of the emergency broadcast system.</p>" ,
118
+ element = $ ( content ) ;
119
+ $ ( "#tooltipped1" ) . tooltip ( {
120
+ content : element ,
121
+ open : function ( event , ui ) {
122
+ equal ( ui . tooltip . children ( ) . html ( ) . toLowerCase ( ) , content ) ;
123
+ }
124
+ } ) . tooltip ( "open" ) ;
125
+ } ) ;
126
+
103
127
test ( "items" , function ( ) {
104
128
expect ( 2 ) ;
105
129
var event ,
Original file line number Diff line number Diff line change @@ -208,7 +208,8 @@ return $.widget( "ui.tooltip", {
208
208
that = this ,
209
209
eventType = event ? event . type : null ;
210
210
211
- if ( typeof contentOption === "string" ) {
211
+ if ( typeof contentOption === "string" || contentOption . nodeType ||
212
+ contentOption . jquery ) {
212
213
return this . _open ( event , target , contentOption ) ;
213
214
}
214
215
@@ -276,13 +277,9 @@ return $.widget( "ui.tooltip", {
276
277
// JAWS announces deletions even when aria-relevant="additions"
277
278
// Voiceover will sometimes re-read the entire log region's contents from the beginning
278
279
this . liveRegion . children ( ) . hide ( ) ;
279
- if ( content . clone ) {
280
- a11yContent = content . clone ( ) ;
281
- a11yContent . removeAttr ( "id" ) . find ( "[id]" ) . removeAttr ( "id" ) ;
282
- } else {
283
- a11yContent = content ;
284
- }
285
- $ ( "<div>" ) . html ( a11yContent ) . appendTo ( this . liveRegion ) ;
280
+ a11yContent = $ ( "<div>" ) . html ( tooltip . find ( ".ui-tooltip-content" ) . html ( ) ) ;
281
+ a11yContent . removeAttr ( "id" ) . find ( "[id]" ) . removeAttr ( "id" ) ;
282
+ a11yContent . appendTo ( this . liveRegion ) ;
286
283
287
284
function position ( event ) {
288
285
positionOption . of = event ;
You can’t perform that action at this time.
0 commit comments