mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-10 22:58:33 +02:00
This includes an update to the underlying version of uglify which causes all of the JS to be modified. See #34177 Built from https://develop.svn.wordpress.org/trunk@35538 git-svn-id: http://core.svn.wordpress.org/trunk@35502 1a063a9b-81f0-0310-95a4-ce76da25c4cd
96 lines
8.7 KiB
JavaScript
96 lines
8.7 KiB
JavaScript
/*!
|
|
* jQuery UI Tooltip 1.11.4
|
|
* http://jqueryui.com
|
|
*
|
|
* Copyright jQuery Foundation and other contributors
|
|
* Released under the MIT license.
|
|
* http://jquery.org/license
|
|
*
|
|
* http://api.jqueryui.com/tooltip/
|
|
*/
|
|
!function(a){"function"==typeof define&&define.amd?
|
|
// AMD. Register as an anonymous module.
|
|
define(["jquery","./core","./widget","./position"],a):
|
|
// Browser globals
|
|
a(jQuery)}(function(a){return a.widget("ui.tooltip",{version:"1.11.4",options:{content:function(){
|
|
// support: IE<9, Opera in jQuery <1.7
|
|
// .text() can't accept undefined, so coerce to a string
|
|
var b=a(this).attr("title")||"";
|
|
// Escape title, since we're going from an attribute to raw HTML
|
|
return a("<a>").text(b).html()},hide:!0,
|
|
// Disabled elements have inconsistent behavior across browsers (#8661)
|
|
items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,tooltipClass:null,track:!1,
|
|
// callbacks
|
|
close:null,open:null},_addDescribedBy:function(b,c){var d=(b.attr("aria-describedby")||"").split(/\s+/);d.push(c),b.data("ui-tooltip-id",c).attr("aria-describedby",a.trim(d.join(" ")))},_removeDescribedBy:function(b){var c=b.data("ui-tooltip-id"),d=(b.attr("aria-describedby")||"").split(/\s+/),e=a.inArray(c,d);-1!==e&&d.splice(e,1),b.removeData("ui-tooltip-id"),d=a.trim(d.join(" ")),d?b.attr("aria-describedby",d):b.removeAttr("aria-describedby")},_create:function(){this._on({mouseover:"open",focusin:"open"}),
|
|
// IDs of generated tooltips, needed for destroy
|
|
this.tooltips={},
|
|
// IDs of parent tooltips where we removed the title attribute
|
|
this.parents={},this.options.disabled&&this._disable(),
|
|
// Append the aria-live region so tooltips announce correctly
|
|
this.liveRegion=a("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body)},_setOption:function(b,c){var d=this;return"disabled"===b?(this[c?"_disable":"_enable"](),void(this.options[b]=c)):(this._super(b,c),void("content"===b&&a.each(this.tooltips,function(a,b){d._updateContent(b.element)})))},_disable:function(){var b=this;
|
|
// close open tooltips
|
|
a.each(this.tooltips,function(c,d){var e=a.Event("blur");e.target=e.currentTarget=d.element[0],b.close(e,!0)}),
|
|
// remove title attributes to prevent native tooltips
|
|
this.element.find(this.options.items).addBack().each(function(){var b=a(this);b.is("[title]")&&b.data("ui-tooltip-title",b.attr("title")).removeAttr("title")})},_enable:function(){
|
|
// restore title attributes
|
|
this.element.find(this.options.items).addBack().each(function(){var b=a(this);b.data("ui-tooltip-title")&&b.attr("title",b.data("ui-tooltip-title"))})},open:function(b){var c=this,d=a(b?b.target:this.element).closest(this.options.items);
|
|
// No element to show a tooltip for or the tooltip is already open
|
|
d.length&&!d.data("ui-tooltip-id")&&(d.attr("title")&&d.data("ui-tooltip-title",d.attr("title")),d.data("ui-tooltip-open",!0),
|
|
// kill parent tooltips, custom or native, for hover
|
|
b&&"mouseover"===b.type&&d.parents().each(function(){var b,d=a(this);d.data("ui-tooltip-open")&&(b=a.Event("blur"),b.target=b.currentTarget=this,c.close(b,!0)),d.attr("title")&&(d.uniqueId(),c.parents[this.id]={element:this,title:d.attr("title")},d.attr("title",""))}),this._registerCloseHandlers(b,d),this._updateContent(d,b))},_updateContent:function(a,b){var c,d=this.options.content,e=this,f=b?b.type:null;return"string"==typeof d?this._open(b,a,d):(c=d.call(a[0],function(c){
|
|
// IE may instantly serve a cached response for ajax requests
|
|
// delay this call to _open so the other call to _open runs first
|
|
e._delay(function(){
|
|
// Ignore async response if tooltip was closed already
|
|
a.data("ui-tooltip-open")&&(
|
|
// jQuery creates a special event for focusin when it doesn't
|
|
// exist natively. To improve performance, the native event
|
|
// object is reused and the type is changed. Therefore, we can't
|
|
// rely on the type being correct after the event finished
|
|
// bubbling, so we set it back to the previous value. (#8740)
|
|
b&&(b.type=f),this._open(b,a,c))})}),void(c&&this._open(b,a,c)))},_open:function(b,c,d){function e(a){j.of=a,g.is(":hidden")||g.position(j)}var f,g,h,i,j=a.extend({},this.options.position);if(d){if(f=this._find(c))return void f.tooltip.find(".ui-tooltip-content").html(d);
|
|
// if we have a title, clear it to prevent the native tooltip
|
|
// we have to check first to avoid defining a title if none exists
|
|
// (we don't want to cause an element to start matching [title])
|
|
//
|
|
// We use removeAttr only for key events, to allow IE to export the correct
|
|
// accessible attributes. For mouse events, set to empty string to avoid
|
|
// native tooltip showing up (happens only when removing inside mouseover).
|
|
c.is("[title]")&&(b&&"mouseover"===b.type?c.attr("title",""):c.removeAttr("title")),f=this._tooltip(c),g=f.tooltip,this._addDescribedBy(c,g.attr("id")),g.find(".ui-tooltip-content").html(d),
|
|
// Support: Voiceover on OS X, JAWS on IE <= 9
|
|
// JAWS announces deletions even when aria-relevant="additions"
|
|
// Voiceover will sometimes re-read the entire log region's contents from the beginning
|
|
this.liveRegion.children().hide(),d.clone?(i=d.clone(),i.removeAttr("id").find("[id]").removeAttr("id")):i=d,a("<div>").html(i).appendTo(this.liveRegion),this.options.track&&b&&/^mouse/.test(b.type)?(this._on(this.document,{mousemove:e}),
|
|
// trigger once to override element-relative positioning
|
|
e(b)):g.position(a.extend({of:c},this.options.position)),g.hide(),this._show(g,this.options.show),
|
|
// Handle tracking tooltips that are shown with a delay (#8644). As soon
|
|
// as the tooltip is visible, position the tooltip using the most recent
|
|
// event.
|
|
this.options.show&&this.options.show.delay&&(h=this.delayedShow=setInterval(function(){g.is(":visible")&&(e(j.of),clearInterval(h))},a.fx.interval)),this._trigger("open",b,{tooltip:g})}},_registerCloseHandlers:function(b,c){var d={keyup:function(b){if(b.keyCode===a.ui.keyCode.ESCAPE){var d=a.Event(b);d.currentTarget=c[0],this.close(d,!0)}}};
|
|
// Only bind remove handler for delegated targets. Non-delegated
|
|
// tooltips will handle this in destroy.
|
|
c[0]!==this.element[0]&&(d.remove=function(){this._removeTooltip(this._find(c).tooltip)}),b&&"mouseover"!==b.type||(d.mouseleave="close"),b&&"focusin"!==b.type||(d.focusout="close"),this._on(!0,c,d)},close:function(b){var c,d=this,e=a(b?b.currentTarget:this.element),f=this._find(e);
|
|
// The tooltip may already be closed
|
|
// The tooltip may already be closed
|
|
// disabling closes the tooltip, so we need to track when we're closing
|
|
// to avoid an infinite loop in case the tooltip becomes disabled on close
|
|
// Clear the interval for delayed tracking tooltips
|
|
// only set title if we had one before (see comment in _open())
|
|
// If the title attribute has changed since open(), don't restore
|
|
// Remove 'remove' binding only on delegated targets
|
|
// We set ui-tooltip-open immediately upon open (in open()), but only set the
|
|
// additional data once there's actually content to show (in _open()). So even if the
|
|
// tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in
|
|
// the period between open() and _open().
|
|
return f?(c=f.tooltip,void(f.closing||(clearInterval(this.delayedShow),e.data("ui-tooltip-title")&&!e.attr("title")&&e.attr("title",e.data("ui-tooltip-title")),this._removeDescribedBy(e),f.hiding=!0,c.stop(!0),this._hide(c,this.options.hide,function(){d._removeTooltip(a(this))}),e.removeData("ui-tooltip-open"),this._off(e,"mouseleave focusout keyup"),e[0]!==this.element[0]&&this._off(e,"remove"),this._off(this.document,"mousemove"),b&&"mouseleave"===b.type&&a.each(this.parents,function(b,c){a(c.element).attr("title",c.title),delete d.parents[b]}),f.closing=!0,this._trigger("close",b,{tooltip:c}),f.hiding||(f.closing=!1)))):void e.removeData("ui-tooltip-open")},_tooltip:function(b){var c=a("<div>").attr("role","tooltip").addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||"")),d=c.uniqueId().attr("id");return a("<div>").addClass("ui-tooltip-content").appendTo(c),c.appendTo(this.document[0].body),this.tooltips[d]={element:b,tooltip:c}},_find:function(a){var b=a.data("ui-tooltip-id");return b?this.tooltips[b]:null},_removeTooltip:function(a){a.remove(),delete this.tooltips[a.attr("id")]},_destroy:function(){var b=this;
|
|
// close open tooltips
|
|
a.each(this.tooltips,function(c,d){
|
|
// Delegate to close method to handle common cleanup
|
|
var e=a.Event("blur"),f=d.element;e.target=e.currentTarget=f[0],b.close(e,!0),
|
|
// Remove immediately; destroying an open tooltip doesn't use the
|
|
// hide animation
|
|
a("#"+c).remove(),
|
|
// Restore the title
|
|
f.data("ui-tooltip-title")&&(
|
|
// If the title attribute has changed since open(), don't restore
|
|
f.attr("title")||f.attr("title",f.data("ui-tooltip-title")),f.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}})}); |