Jump to content
  • Status: Not a bug

I created a hook in CORE/FRONT/GLOBAL/GLOBALTEMPLATE » HEAD:BEFORE, but it broke the theme on the front end. All links and scripts from the <head> tag were moved into the <body> tag. Please check all the attached images.

image.pngimage.pngimage.png

User Feedback

Recommended Comments

teraßyte

Clients

You really shouldn’t add HTML before or after the <head> tag, nor <body> for that matter. Only inside them.

Alexandru

Clients
5 minutes ago, teraßyte said:

You really shouldn’t add HTML before or after the <head> tag, nor <body> for that matter. Only inside them.

If I have the option to do it, why wouldn’t I? Your response doesn’t make much sense right now. Besides, I tested it, and this issue shouldn’t be occurring. I reported it because it’s clearly a bug.
😑

teraßyte

Clients
2 minutes ago, Alexandru said:

If I have the option to do it, why wouldn’t I?

Because it’s not valid HTML. The bug here is not that the HTML breaks, but that it shouldn’t allow you to choose that option.

Alexandru

Clients
1 hour ago, teraßyte said:

Because it’s not valid HTML

What do you mean? Since when <div>test</div> is not a valid HTML? 😂. Look, I get your point but I just tested it, let’s see what IPS has to say.

To be honest, I really miss the Theme Editor in IPS v4. It's one of the main reasons I’m hesitant to move to IPS v5. I want to avoid complicating my work, and I know my clients feel the same way. As a result, we plan to stay on v4 for as long as possible. Moving over 200 active clients to IPS v5 would be incredibly challenging and time-consuming process.

teraßyte

Clients
(edited)

By valid HTML I mean that a DIV element MUST be inside <BODY>. You can’t add it before/after/inside the <HEAD> element, nor you can add it before/after the <BODY> element.

You’re adding a <DIV> element before <HEAD> which results in this (extremely simplified) HTML below:

<!DOCTYPE html>
<html lang="en-US">
<div>Test</div>
<head>
  <title>Testing a wrong DIV element</title>
</head>

<body>
  <div>This is a DIV inside the BODY element.</div>
</body>
</html>

Try validating that HTML code and see you’ll get errors: https://validator.w3.org/#validate_by_input

Then remove that first DIV above <HEAD> and you’ll see the validation is okay:

<!DOCTYPE html>
<html lang="en-US">
<!-- TEST DIV REMOVED -->
<head>
  <title>Testing a wrong DIV element</title>
</head>

<body>
  <div>This is a DIV inside the BODY element.</div>
</body>
</html>

Basically, the browser is trying to compensate/fix the HTML (but fails miserably) because you added an unexpected/wrong DIV element where it shouldn’t go.

Edited by teraßyte

Alexandru

Clients

I know how HTML works, but it’s still a bug they have to fix. Either don’t allow HTML Tags before head or remove that option.

opentype

Clients

It’s a developer feature. It’s not meant to be idiot-proof. They are not going to prevent you from adding faulty code, nor will they remove that option, because adding code to the header is important. There is no bug here. You just found one of millions of ways to break a site with faulty code.

Matt

Management
  • Management

As above, it’s not really a bug in the software.

Matt

Management
  • Management

Changed Status to Not a bug