Skip to content

hx:include tag is messing up the head tag #73

Description

@appdezign

I'm using hinclude to include a CSRF token in a laravel blade page that has been cached with HTTPCache.
When I put the CSRF token inside the body tag, everything works as expected.

<body>
<form>
<hx:include src="/csrf/input">
	<input type="hidden" name="_token" value="2viCQ8L7G0aHOsEQwf811kR2wLoozZl3uhEemshv">
</hx:include>
</form>
</body>

But when I put the CSRF token in a meta tag in the head (for AJAX requests), the head gets mixed up when I look in the web inspector. The hx:include tag has been moved to the body(!), and every tag that comes AFTER the hx:include tag in the head, is also moved to the body. See code example below.

My question is: am I doing something wrong here? Or are we not supposed to us the hx:include tag in the head?

View source (Chrome):

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<script src="/assets/themes/ambion2020/js/vendor/hinclude/hinclude.js"></script>
	<hx:include src="/csrf/meta"></hx:include>
	<meta name="description" content="">
	<meta name="keywords" content="">
</head>
<body>
	<div class="wrapper"></div>
</body>
</html>

Web Inspector (Chrome/Firefox):

<html lang="en"><head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<script src="/assets/themes/ambion2020/js/vendor/hinclude/hinclude.js"></script>
</head>
<body>
	<hx:include src="/csrf/meta" class="included include_200">
		<meta name="csrf-token" content="2viCQ8L7G0aHOsEQwf811kR2wLoozZl3uhEemshv">
	</hx:include>
	<meta name="description" content="">
	<meta name="keywords" content="">
	<div class="wrapper"></div>
</body>
</html>

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions