Mention
  • Home (current)
  • Help
    FAQ Privacy Contact
Quick menu
Night mode
Sign in
Register
Mention
General Discussion
Why are there so many DOM errors?
4 months ago
TestUser
TestUser Administrator
TestUser
Quick menu
User profile
All posts
Administrator
4 months ago
Message Options
More
Copy short link
Share

I will give information about why there are so many errors.
 
MentionBB uses DOM Manipulation to manage plugins. This system is very similar to jQuery. It has almost the same methods. append(), prepend() etc. This way the whole page can be edited. All you need is an "html class/id/data". As far as I know, this system only works on MentionBB, so it's a first PR.
 

 
BUT the biggest shortcoming of this system is that the DOM is actually very primitive. In fact, there is only HTML4 support, and that is quite limited. Besides, we wouldn't want to use pre-existing HTML4 in a modern system, would we? To prevent this, I used masterminds/html5-php for a long time, I still use it, and without them this system would not exist. Of course there is no dom-manipulation that I mentioned in this repo, it is just a parser. But with PHP 8.4 we will finally be able to use HTML5 without adding an external repo, but that is still in its early stages. Still, I added this for MentionBB. So there are 2 parsers.
 
BUT 2. When adding this new content (coming from the plugin) to the desired location, we use a method: appendXML(). This is the source of the problem.
 
https://github.com/mentionbb/mentionbb/blob/master/src/App/Hook/DomManipulation/DomManipulation.php#L127
 
Because this method does not recognize HTML5, in fact this method was made only for XML. So how do we add new content? I've already tried a bunch of new methods.
 
At first I tried to change the content only with preg_replace but that made it even worse. Then I opened the content from the plugin with Dom and edited and saved it. But it was too slow.
 
Then I had a bright idea. Add all the content as HTML comments and then edit it on the main page. At this point, this system is already working great but we need more testing and debugging.
 
For this reason, do not forget to report any errors you see to me on the Github page: https://github.com/mentionbb/mentionbb/issues/new/choose
 
https://github.com/mentionbb/mentionbb/commit/21bd23d3108b2d4e7437392ed47889008c44efdd
https://github.com/mentionbb/mentionbb/commit/ef1a255f4079e224c64dd1873eed9f2bb7c2ba9b
Slaweally left an reaction for it.
This post TestUser edited by 4 months ago.

Like
Share
This post was sent from Windows device.
Sort by
New message
By likes
Old to new
0 Reply
There is nothing to display here.

Write a new message.

Discussion post
1 / 1
First post
Login
Mention
or

Dont have an account sign up now!

I forgot my password
Register
Mention
Verification code will be sent.

Choose your password as reliable, if you wish, you can turn on two-step verification after registration, so you can log in with the Google Authentication application.

or

If you have an account You can login now.

I forgot my password
Please enter a valid e-mail address.
This site uses cookies to personalize content, improve your experience and also for actions such as Registration and Login. By using our site you accept this: Our Privacy Policy.