-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
JavaScript validation performance (2) #7460
Conversation
@erimkus you still have site with 250 User groups? can you check whether current fix helps you? 😄 |
No sir, back down to 6 groups now. Thank you though.
|
@test works 👍 |
Conflicts: administrator/components/com_modules/views/module/tmpl/edit_assignment.php libraries/joomla/form/fields/rules.php media/system/js/core.js
hm, why Travis filed for php 5.6 but for other is fine? 😄 |
@Fedik it is:
|
yes, but I wonder why the test pass for other versions 😉 |
@Fedik PHPCS runs only for PHP 5.6... |
ok, thanks for explanation 😉 |
Conflicts: media/system/js/validate.js
I tested this patch and it works. Save and Close instead of 10 seconds before the patch it takes 1 second after the patch has been applied! This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/7460. |
@aantic please mark as tested https://issues.joomla.org/tracker/joomla-cms/7360 (after login the Test button appears). See https://docs.joomla.org/Testing_Joomla!_patches#Recording_test_results |
I have tested this item ✅ successfully on b437f5a This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/7460. |
Can you fix the conflicts first please |
Conflicts: media/system/js/core.js media/system/js/validate.js
This PR has received new commits. CC: @aantic, @AnneKlapwijk, @RemcoJanssen This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/7460. |
yes, updated, was just a conflict between the minified script version |
OK thanks. I will make it RTC this evening
|
This patch is nice,
But why do these fields cost a lot anyway during validation ?
well it is the label search in both validation for
and most of the fields that are excluded by this patch do not have ID-lbl thus a full DOM search done for each of them,
i have a form about 500 elements and
But it is late and i may be writing something stupid I will confirm everything tomorrow / or on saturday and make a PR , I found the above while looking through validation code to make the PR for the max_input_vars workaround
because i remember this discussion before, so i don't understand why that code is there, the way it is now but again i maybe missing something |
I feel like I need to answer 😃 All what you wrote is correct. With
From my point of view
You know, with 200 user groups/modules you will have a couple thousands different inputs 😉 |
well both of them, have performance issue with labels
i have made a fix for performance issue with the labels, fix also includes check for
thus works with both cases of full form validation / single field validation
for validate.js it is as you say Joomla allows to override it and this is very convenient for custom components ... about how useful html5fallback.js well now it is supposed to make joomla forms browser agnostic and it is a couple of things more than placeholder support by the browser
|
Regardless of avoiding full DOM search for finding individual labels of fields
|
yes you are right HTML5 validation attributes are not used Furthermore validateForm() of html5fallback.js runs after isValid() succeeds I have enabled fixed findLabel performance e.g. 10,000 fields (e.g. like buttons that you excluded) also enabled HTML5 validation for modern browsers / IE10+ |
Question about: this PR adds into
and currently validate parameter is never passed by any form, is this what we want ? [EDIT]
|
It was running accidentally (because
yeap, it for keep an old behavior, see #6587 In my sites I have made hack by plugin that removes html5fallback.js (and some other) and all works fine, more than year already 😄 |
yes i had seen that PR #6587, and had i understood the reason and what it does your answer is helpful , thanks !
e.g. i can not be placed inside html5fallback.js, as this may not be loaded or we can even consider it optional
It is best to place the new code inside core.js To be more precise the code for:
So i will make
|
Ok i figured out why HTML5 validation is not running
and because novalidate is the HTML5 specification attribute for stopping HTML5 validation
i think this is a behaviour change, some forms maybe using HTML5 validation ! here is a more ? proper code :
|
via |
Yes it is exactly , as you say above,
but still the question is , do we want to prevent HTML5 validation from running ? |
I think for Joomla! 3.x.x we do not have much choose. As we need to use |
I did not say to change anything in Joomla validation code (validate.js) it does not need to change
i only said why stop HTML5 browser's validation ?
If we want to remove html5fallback.js, that is another topic but it is not related to allowing HTML5 validation to be runned by the browser anyway i will make a PR soon |
There is only 1 problem with allowing HTML5 validation to run,
[EDIT] we can stop HTML5 validation:
|
yes, and it already possible, developer can make his own // Toolbar
Joomla.submitbutton('save'); // Save button
Joomla.submitbutton('cancel'); // Cancel button
// Extension specific submit method
Joomla.submitbutton = function(task){
var form = document.getElementById('specific-form-id'),
validate = task !== 'cancel';
Joomla.submitform(task, form, validate);
} |
Since this was merged into staging, many people are now using it
What do you mean with "System J3.5.1" ? It is possible to test a PR (before it is merged)
because every PR takes for granted that you have all other files of the branch In this case it was merged into the "staging" branch,
|
This pull speed up the form validation by ignoring fields:
rules
,filters
,assigned
as they do not need to be validated anyway.Results on default test installation:
Before (in edit module form):
Validate take 4ms
After (in edit module form):
Validate take 2ms
I count time between push Save button (validation start) and form submit (validation finished).
In result (on default test installation) I get 2 times faster validation, but main target is users who have hundreds of User groups.
Test
Create 200 user groups and compare performance on save the Global Configuration and any Module form.
Also test other forms (on frontend also), whether they still work as expected
UPD: Graph with the final result in that comment #7460 (comment)