🌐 AI搜索 & 代理 主页
Skip to content

jQuery.fn.load Uncaught TypeError: url.indexOf is not a function  #3940

@jdmx

Description

@jdmx

Description

I am getting an error in v3.2.1 that I was not getting in v1.12.3 and I have traced it to the jQuery.fn.load function.

In v1.12.3, the jQuery.fn.load function begins as such.
jQuery.fn.load = function( url, params, callback ) { if ( typeof url !== "string" && _load ) { return _load.apply( this, arguments ); } var selector, type, response, self = this, off = url.indexOf( " " );

In v3.2.1, the jQuery.fn.load function begins as such.
jQuery.fn.load = function( url, params, callback ) { var selector, type, response, self = this, off = url.indexOf( " " );

The lines
if ( typeof url !== "string" && _load ) { return _load.apply( this, arguments ); }
have been removed out of the new version.

The error occurs when I try to run this snippet of code.
var ifr = $('<iframe/>', { src: url, load: function() { alert('here'); }, frameborder: '0' });

The definition of load within the iframe creation is what is causing the TypeError.

Link to test case

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions