cham 0

I'm using a hosted service that allows for some custom template code to be added. Problem is, they're putting this code inside a large table that encompasses the entire layout. This seems to be effecting the manner in which the page is rendered, with the header popping in place immediately, then the layout code a few seconds afterward, all at once. The structure:

<table id="hosted_wrapper">
<tr>
    <td>(Large amounts of custom HTML/CSS here)</td>
</tr>
</table>

Our idea is to close the table out with javascript before rendering, such that #hosted_wrapper has '' added to it just prior to our custom HTML/CSS code, cleaving off the initial table, and allowing the followup divs to render as they're received.

I've been poking around with our layout in jquery some, and it doesn't seem to be taking. Is this possible? Is there another way?

  • To clarify: We enter the custom code into a form on provider's website, and it can be anything we want it to be. It's unfortunately just injected into the middle of this #hosted_wrapper table which is in their global template. There is also a separate form that allows us to inject code into <head>. cham over 7 years ago
  • With coffee intake, the solution to above problem becomes clear: Begin the custom code with a table end tag, and the end of the custom code with a start table tag. cham over 7 years ago

2 answers

danwellman 5600
1
point
This was chosen as the best answer

so that #hosted_wrapper has what added to it just before your custom code? it hasn't come out properly in the question so I'm guessing it's a </table> tag?

Does your custom code have a wrapper element with an id or a unique class name? If so, let the table render naturally, then select the wrapper element and append it directly after the table, then remove the table, something like:

$(function() {
  $("#myWrapperId").insertAfter("#hosted_wrapper");
  $("#hosted_wrapper").remove();
});

That ought to do it :)

Answered over 7 years ago by danwellman
-1
points

It sounds difficult to close the table without creating invalid nesting of tags (which will do more damage).

Maybe you could rebuild the entire table with JS instead, replace it with a div or something. This will be very calculation intensive as you will have to (re-)wrap the entire site with a div. Shuffling all of them childNodes will call for some heavy duty work on the client side :)

Being wrapped in a table however shouldn't cause any serious problems (allthough it's ugly unsemantic HTML) as long as you reset the styling of it.

Answered over 7 years ago by Jens Hedqvist