symfony-collection-js
Advanced tools
Comparing version 4.2.0-js-only to 4.2.0
@@ -44,3 +44,2 @@ // Karma configuration | ||
coverageReporter: { | ||
type : 'html', | ||
dir : 'coverage/without_jquery/', | ||
@@ -103,2 +102,2 @@ reporters: [ | ||
}) | ||
} | ||
} |
{ | ||
"name": "symfony-collection-js", | ||
"version": "4.2.0-js-only", | ||
"version": "4.2.0", | ||
"description": "A plugin working with and without jquery to dynamically create elements of a symfony form collection.", | ||
@@ -5,0 +5,0 @@ "main": "symfonyCollectionJs.js", |
@@ -1,2 +0,2 @@ | ||
# symfonyCollectionJs ![GitHub](https://img.shields.io/github/license/ruano-a/symfonyCollectionJs) ![Maintenance](https://img.shields.io/maintenance/yes/2021) ![GitHub last commit](https://img.shields.io/github/last-commit/ruano-a/symfonyCollectionJs) ![npm](https://img.shields.io/npm/dm/symfony-collection-js?label=npm%20downloads) [![](https://data.jsdelivr.com/v1/package/npm/symfony-collection-js/badge)](https://www.jsdelivr.com/package/npm/symfony-collection-js) [![codecov](https://codecov.io/gh/ruano-a/symfonyCollectionJs/branch/master-js-only/graph/badge.svg?token=Z93Y3NTP1Q)](https://codecov.io/gh/ruano-a/symfonyCollectionJs) ![npm bundle size](https://img.shields.io/bundlephobia/min/symfony-collection-js) ![Dependencies](https://badgen.net/bundlephobia/dependency-count/symfony-collection-js) ![Badge count](https://img.shields.io/badge/badge%20count-enough%20%3C3-blue) | ||
# symfonyCollectionJs ![GitHub](https://img.shields.io/github/license/ruano-a/symfonyCollectionJs) ![Maintenance](https://img.shields.io/maintenance/yes/2021) ![GitHub last commit](https://img.shields.io/github/last-commit/ruano-a/symfonyCollectionJs) ![npm](https://img.shields.io/npm/dm/symfony-collection-js?label=npm%20downloads) [![](https://data.jsdelivr.com/v1/package/npm/symfony-collection-js/badge)](https://www.jsdelivr.com/package/npm/symfony-collection-js) [![codecov](https://codecov.io/gh/ruano-a/symfonyCollectionJs/branch/master/graph/badge.svg?token=Z93Y3NTP1Q)](https://codecov.io/gh/ruano-a/symfonyCollectionJs) ![npm bundle size](https://img.shields.io/bundlephobia/min/symfony-collection-js) ![Dependencies](https://badgen.net/bundlephobia/dependency-count/symfony-collection-js) ![Badge count](https://img.shields.io/badge/badge%20count-enough%20%3C3-blue) | ||
A plugin working with and without jquery to dynamically create elements of a symfony form collection. | ||
@@ -18,3 +18,3 @@ | ||
```html | ||
<script src="https://cdn.jsdelivr.net/gh/ruano-a/symfonyCollectionJs@4.1.0-js-only/symfonyCollectionJs.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/gh/ruano-a/symfonyCollectionJs@4.1.0/symfonyCollectionJs.min.js"></script> | ||
``` | ||
@@ -118,6 +118,2 @@ | ||
# Requirement | ||
Symfony 2 or more (For a normal usage, but you can use this without) | ||
# Can I use this package without symfony ? | ||
@@ -128,2 +124,6 @@ | ||
# Requirement | ||
Symfony 2 or more (For a normal usage, but you can use this without) | ||
# Notes | ||
@@ -130,0 +130,0 @@ If you're using this without jQuery, but with a loader (AMD, CommonJS, or anything), you MUST use a version on a branch / tag with "js-only" in the name! Otherwise it WILL NOT BUILD! (I didn't want to make several versions but tests ended showing that it was the best choice... Unless you have a better idea?) |
@@ -397,16 +397,33 @@ // Polyfill from https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent | ||
}; | ||
// UMD : Uses CommonJS, AMD or browser globals | ||
formCollection.jQuery = null; | ||
// UMD : Uses CommonJS, AMD or browser globals to create a jQuery plugin (if jQuery is there) | ||
(function(root, factory) { | ||
if (typeof define === 'function' && define.amd) { | ||
// AMD. Register as an anonymous module. | ||
define([], factory); | ||
define(['jquery'], factory); | ||
} else if (typeof module === 'object' && module.exports) { | ||
// Node/CommonJS | ||
module.exports = factory(); | ||
module.exports = factory(require('jquery')); | ||
} else { | ||
// Browser globals | ||
root.returnExports = factory(); | ||
if (typeof jQuery !== 'undefined') | ||
root.returnExports = factory(jQuery); | ||
else | ||
root.returnExports = factory(); | ||
} | ||
}(this, function() { | ||
}(this, function($) { | ||
if (typeof jQuery !== 'undefined' && jQuery) { | ||
formCollection.jQuery = $; // jQuery is not necessarily global so it's better to know easily if it's available | ||
$.fn.formCollection = function (options, param) { | ||
var nodeArray = []; | ||
for (var i = 0; i < this.length; i++) { | ||
nodeArray.push(this[i]); | ||
} | ||
var ret = formCollection(nodeArray, options, param); | ||
if (!Array.isArray(ret)) | ||
return ret; | ||
return $(this); | ||
}; | ||
} | ||
return formCollection; | ||
})); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
395159
32
6320
0