Data: Don't expose jQuery.acceptData

jQuery.acceptData is an undocumented internal API that shouldn't be exposed.

Fixes gh-2555
This commit is contained in:
Jason Bedard
2015-08-24 19:56:57 -07:00
committed by Michał Gołębiowski
parent 02e10082b2
commit 224271982e
5 changed files with 27 additions and 33 deletions

View File

@@ -1,15 +1,14 @@
define( [
"../core",
"../var/rnotwhite",
"./accepts"
], function( jQuery, rnotwhite ) {
"./var/acceptData"
], function( jQuery, rnotwhite, acceptData ) {
function Data() {
this.expando = jQuery.expando + Data.uid++;
}
Data.uid = 1;
Data.accepts = jQuery.acceptData;
Data.prototype = {
@@ -38,7 +37,7 @@ Data.prototype = {
// We can accept data for non-element nodes in modern browsers,
// but we should not, see #8335.
// Always return an empty object.
if ( !Data.accepts( owner ) ) {
if ( !acceptData( owner ) ) {
return {};
}

View File

@@ -1,12 +1,9 @@
define( [
"../core"
], function( jQuery ) {
define( function() {
/**
* Determines whether an object can have data
*/
jQuery.acceptData = function( owner ) {
return function( owner ) {
// Accepts only:
// - Node
// - Node.ELEMENT_NODE
@@ -17,5 +14,4 @@ jQuery.acceptData = function( owner ) {
return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
};
return jQuery.acceptData;
} );