Skip to content

Conversation

@nbolender
Copy link
Contributor

What does this PR do?

jQuery 3.5 introduced a breaking change, which basically means that jQuery previously would expand a self-closing tag into opening and closing tags, but now it does not. For example:

// jQuery < 3.5
$('<textarea />'); // Expands to <textarea></textarea>

// jQuery >= 3.5
$('<textarea />'); // Remains <textarea />
                   // which is interpreted by browsers as an opening tag with no closing tag

Normally this does not cause issues, but Chrome is particularly sensitive to an unclosed <textarea> tag. This caused the issue in #3820

This PR replaces the self-closing syntax with explicitly-closed syntax for any non-void HTML elements. It also fixes #3820 once and for all.

Where should the reviewer start?

Make sure I covered all self-closing situations in the codebase.

How should this be manually tested?

  • Run existing summernote version with jQuery >= 3.5

  • Try to submit a form with a summernote field in Chrome

  • Observe error in Chrome console: Form submission failed, as the <TEXTAREA> element named '' was implicitly closed by reaching the end of the file. Please add an explicit end tag ('</TEXTAREA>')

  • Build this PR and run same procedure above

  • Observe that form submits successfully

Any background context you want to provide?

What are the relevant tickets?

Checklist

  • Added relevant tests or not required
  • Didn't break anything

@DennisSuitters
Copy link
Member

I've been using Summernote with the updated patch to jQuery 3.5, 3.5.1 I think it was, and with the latest jQuery 3.6, without any issues, so I'm wondering if this change is required.

@nbolender
Copy link
Contributor Author

nbolender commented Apr 24, 2021

@DiemenDesign I checked with a build from the latest develop branch and jQuery 3.6.0 and this issue was present for me on the latest Chrome for macOS.

I also checked with the latest tagged release and jQuery 3.5.1 and also had the issue.

I think it may only happen in Chrome under certain situations, but closing the <textarea> tags immediately fixed it for me.

@DennisSuitters
Copy link
Member

The only difference for me, from the looks of it, is I'm using Chrome in Linux. I wonder if the Chrome build in Mac is a little different? I wouldn't have thought it would be. Anyway, I just wanted to check with you, as I'll also have to add these changes to the Skunkworks repository, and if it was a non-issue considering the upgrade of jQuery, if it was worth my time to do so.

@nbolender
Copy link
Contributor Author

If it is a lot of trouble to merge all of these changes, I think only updating the lines related to <textarea> will fix the linked issue. I just did the rest to be thorough.

@DennisSuitters
Copy link
Member

I was just looking through some of the Skunkworks source, some of which has had the updates similar to what you've made in this PR.

I realise you've tested the <textarea/> issue, have you checked that the changes to the other elements haven't broken things? I know the error reporting when building won't show errors for these, but using Summernote in the Browser may make it behave strangely. Just want to be sure before doing a merge, only to find that we have to undo things.

@nbolender
Copy link
Contributor Author

No I have not checked, other than a quick test where summernote seemed to be behaving normally.

It is my understanding that changing the syntax gets you the same result in jQuery (a single node, closed properly), at least before they made this breaking change.

@DennisSuitters
Copy link
Member

Yeah, wasn't a good move on their part. The only reason I can think why they would do that, was to make the framework a smaller footprint. We are hoping to remove the dependency of jQuery in the future, then these things won't be an issue.

@DennisSuitters
Copy link
Member

I've just been reading some disturbing info about Apple gate keeping software, and in particular the Apple version of Chrome. I'd like to find out for sure, but the post I was reading on Reddit, a few people have mentioned that Chrome on Apple is just Safari with a wrapper to make it look like Chrome. If this is the case, it may explain a lot of inconsistencies between the same software on different OS's. https://www.reddit.com/r/webdev/comments/o5k8gb/rant_i_cant_stand_developing_for_safari_anymore/

Kukks pushed a commit to btcpayserver/btcpayserver that referenced this pull request Sep 2, 2021
As we are using a customized version for the Bootstrap 5 compatibility anyways, with this we are also including the changes proposed in summernote/summernote#4034 to fix #2816.
@lqez lqez merged commit f6d512a into summernote:develop Sep 17, 2021
@lqez
Copy link
Member

lqez commented Sep 17, 2021

Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Form submitting not working after updating Chrome

3 participants