-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use of jquery 2 in Yii2 #1905
Comments
Yeah currently our composer.json restricts jquery version to "yiisoft/jquery": "~1.10 | ~2.0", We need to make sure yii's javascript is compatible with all the versions. PS: docs about |
Also need to check JUI. |
I'll handle it. |
we should not force 2.0 as it is now, as someone might need the IE compatibility. yii should only require versions that are necessary to make yii.js work. Will check whether this works and add documentation. |
+1 when somebody need jquery2.0 He can switch jquery2.0 |
@djfly Logic to have always newer version by default is better. So the better say if somebody need 1.10 he can switch. From newer to older version. But not vise versa. |
yep, thats the plan. |
@creocoder That's nice 👍 |
Bootstrap 3.0.3 requires jquery >=1.9.0 (see https://github.com/twbs/bootstrap/blob/master/bower.json ) and still supports IE8 (see http://getbootstrap.com/getting-started/#browsers ) Maybe there is a good reason why yii wants to require (not recommend) a newer version of jquery than Bootstrap. |
We can use LAB.js and ie_version detection to support jquery 2 with IE fallback. <script src="js/LAB.min.js" type="text/javascript"></script>
<script type="text/javascript">
// From: http://james.padolsey.com/javascript/detect-ie-in-js-using-conditional-comments/
var ie_version=(function(){var c,a=3,b=document.createElement('div'),d=b.getElementsByTagName('i');while(b.innerHTML='<!--[if gt IE '+(++a)+']><i></i><![endif]-->',d[0]);return a>4?a:c})();
$LAB.setOptions({AlwaysPreserveOrder:true})
.script(ie_version<8 ?"https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js" : '')
.script(ie_version<8 ?"//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" : '//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js')
</script> |
changed composer.json docs on how to use jquery 1.10 are here: https://github.com/yiisoft/yii2/blob/master/docs/guide/composer.md#using-a-specifc-version-of-a-package |
Good job! |
Are you sure this was such an awesome idea, especially if some of Yii2 code specifically relies on some new feature or functionality that might be specific to 2.0? As others say, Bootstrapp 3.1.1 still supports IE8 so it seems kind of odd to provide a Jquery that breaks that support. |
@Sammaye you can choose a jquery version for yourself by defining it explicitly in composer.json. The default is the latest version. |
No matter how much I search Google and the docs I cannot find the new location of that page. I need it now that jquery has been changed to a bower dep. |
Meh, it worked as I thought it would but still, good to link this information somewhere; I am sure there are many who will be caught out by JQuery 2.0 requirements on Yii2, especially if they intend to run a retail site. |
here it is gone ;) b663007#diff-fca53aecf2232821dfe114957df0059eL117 Not sure if we should add this back somewhere, this is composer knowledge and can be looked up in composer docs. If someone has a good idea where to place it in the guide, I am open for proposals. |
As bootstrap has removed the support for old IE browser.
So, we should use the latest jquery version and all other latest library also.
The text was updated successfully, but these errors were encountered: