search for: in: entire forum this post
you are here: root => Annoncements => 1.045 offers a very stable protection against big content in posts
member since:

1.045 offers a very stable protection against big content in posts

1.034 was a great update because in this update i finished fixing every thing that i had on my list of bugs. though one of the updates in 1.034, the one that was supposed to protect the page against stretching horizontally or getting too long vertically if ppl included huge elements in their posts, while producing the wanted effect, was also producing various unwanted problems, like basically scroll bars appearing where they shouldn't, making things ugly...

basically to make 1.034 when i decided how i was gonna protect the forum from stretching when ppl specify huge numbers in the width and heights of the tags that they use in their posts, my first idea was to parse the final data at the end of the bbcode function and find width and height parameters and determine their value and cap them with some fixed values. but that solution was not very good because 1 its a lot of work to make, 2 it will use extra resource on the server, 3 it will not allow a relative width and 4 it could get really complicated when ppl use tables to place multiple things in different places...

so anyways luckily i had another idea, my idea was (and i knew that it was gonna be hard to do but possible) to make it so that size of stuff in posts is unlimited and uncontrolled, but with CSS posts would get individual scrolling bars when they get too big, not affecting the rest of the page and the other posts.

that would have been easy with overflow if i wanted to have a fixed size on my table but that was not an option for me. i like relative dimensions they are way better than fixed... so i tried to make something do that with only CSS keeping my dimensions relative but i just couldn't see a way...

so i ended up falling back on JavaScript to do what i needed to do.

i have quite a bit of experience with JavaScript so i was quickly able to make it do what i needed, but using JavaScript to fake CSS is far from ideal. some instability in the loading time of each different page especially when they contain a lot of external elements like ads or images in the posts made it all a pretty unstable method and after 1.034 there were 9 more updates (from 1.035 to 1.044) that were basically all about continuing to fix and tweak this part of the code because i could never be 100% satisfied with it and i really had an uneasy feeling thinking of how i couldn't seem to trust 100% these little JavaScript snippets that were dangerously reformatting all the posts displayed.

after installing the forum on yet another site and creating a few first posts, i noticed a little irregularity in the display on internet explorer so i decided to go back again to have a look at this part of the code and try to ameliorate it, again...

but the revelation is that this time i decided to quickly google my issue once again instead of just continuing to add/remove more of the same thing that i already have. i read somewhere that someone had solved a similar issue by adding a

to the table which contained the stuff. so i tried it out and i learned that not only using table-layout:fixed; on a table makes it load faster and use less CPU in the browser but it also stops the annoying default behavior where the table insists on adapting to the size of the stuff that it contains.

Now thanks to the new discovery of this obscure CSS property i was finally able to have some scroll-bars in an area of a relative size. As soon as i saw that, i knew that i was on the verge of a breakthrough, a breakthrough where all the annoying unstable JavaScript would be thrown out and replaced by a few simple CSS rules.

but you know how CSS is, even after this point it still took me several hours of trying this and trying that before i could shape the new fixed-layout table into what i was trying to do.

now that this part of the code is only dependent on a few inline CSS rules i know it will always work immediately and perfectly each time. so im very happy about this very useful display update. this update is now available in 1.045

though there are still a few small gaps that i left behind for now, but nothing very serious:
  • in a case where the post is both very long and very large the vertical scrolling bar only appears when you scroll at the end of the horizontal scrolling bar on Internet Explorer (first i tried to place both scrolling bars on the same div but while that was fine on all browsers, on ie, the apparition of a horizontal scrolling bar was inevitably causing a vertical scrolling bar to appear, which is apparently a known bug with internet explorer, so for this reason i was forced to turn off the vertical scrolling bar on the div in question. but since i did want to be able to scroll vertically in the case of a very long post anyways, i fixed this by adding another div that scrolls vertically inside of the div that scrolls horizontally, causing a new obvious bug that is still less bad than the initial IE bug. but amazingly Opera, Firefox and Chrome have continued displaying the 2 scrolling bars in sight at all times, which is what i want it to do)
  • in the case of a post that is very long horizontally but also very very short vertically and posted by a user who has a lots of stuff on the left side of the post, making the left side of the table long vertically compared to the right side, the horizontal scrolling bar of the post does not appear at the bottom of the post area, causing it to *look funky. though this problem only affects Firefox and IE because Opera and Chrome always bring the last row of the table all the way up under the post, which is something that already looks a little bit funky in the first place, but i could not seem to avoid for these 2 browsers and well, at least it causes this problem listed here to not exist on these browsers. such a case should be pretty rare anyways
  • the limit on vertical size of a post is dependent of JavaScript in Internet Explorer, (unlike the horizontal limit on all browsers and the vertical limit on all browsers but internet explorer which do not require JavaScript)


test: test
post #145 permalink
please login to reply

moderators of this post

envis (level: ∞)
powered by Nodesforum