Google Groups

Re: [play-framework] [2.x scala] <!DOCTYPE html> whitespace before

Kevin Bosman May 11, 2012 4:38 AM
Posted in group: Play Framework
> Is there any way to force the <!DOCTYPE html> to be at the very top?

Leon, I've had this same problem in the Java api, which I've solved by
simply calling trim() on the Html body before returning it as a
Result, like this:
        public static Content trim(Content content) {
                if (content instanceof Html)
                        return new Html(content.body().trim());
                        return content;

Now I was wondering, do you think it would be generally reasonable and
acceptable to enforce/ensure that there is *never* any whitespace at
the top of *any* Html response? Or do you think that is assuming too
much? (I'm not sure what the W3C spec says, and haven't had the time
to check up on it.)