Skip to content

Commit

Permalink
Fixed bug in $.post() where if the URL is null (which can happen if f…
Browse files Browse the repository at this point in the history
…or example a form action attribute doesn't exist, the default is self), it detected it as a settings object which cause it to crash.
  • Loading branch information
hexydec committed Nov 14, 2019
1 parent 99565d7 commit f5cddf2
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ A lightweight modular jQuery clone/alternative library built for modern browsers

![Licence](https://img.shields.io/badge/Licence-MIT-lightgrey.svg)
![Project Status](https://img.shields.io/badge/Project%20Status-Beta-yellow.svg)
![Size Minified](https://img.shields.io/badge/Size%20(Minified)-17.7kb-brightgreen.svg)
![Size Gzipped](https://img.shields.io/badge/Size%20(Gzipped)-6.43kb-brightgreen.svg)
![Size Minified](https://img.shields.io/badge/Size%20(Minified)-17.6kb-brightgreen.svg)
![Size Gzipped](https://img.shields.io/badge/Size%20(Gzipped)-6.42kb-brightgreen.svg)

**This project is now in beta, make sure to test your integration with this code thoroughly before deploying**

Expand Down
2 changes: 1 addition & 1 deletion src/ajax/getpost/getpost.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "../ajax/ajax.js";
["get", "post"].forEach(name => {
$[name] = (url, data, success, type) => {
const isFunc = $.isFunction(data);
let settings = typeof(url) === "object" ? url : {
let settings = url !== null && typeof url === "object" ? url : {
url: url,
data: isFunc ? {} : data,
success: isFunc ? data : success,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/isplainobject/isplainobject.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import $ from "../../core/core.js";
$.isPlainObject = obj => {

// Basic check for Type object that's not null
if (typeof obj === "object" && obj !== null) {
if (obj !== null && typeof obj === "object") {

// If Object.getPrototypeOf supported, use it
if (typeof Object.getPrototypeOf === 'function') {
Expand Down
2 changes: 1 addition & 1 deletion tests/test.es5.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/test.es5.js.map

Large diffs are not rendered by default.

0 comments on commit f5cddf2

Please sign in to comment.