friendica / red

The Red Matrix
MIT License
214 stars 50 forks source link

regression: readmores.js does not work reliable on webkit based browsers #851

Closed git-marijus closed 9 years ago

git-marijus commented 9 years ago

https://sethmartin.us/channel/seth/?f=&mid=6f7a7f2bb929c7c7be0645a825ea71c35cfe4e9df8248e38dcacbd5b3f2300c9@sethmartin.us This item collapses even more on clicking expand and the link becomes unresponible.

https://sethmartin.us/channel/seth/?f=&mid=15c64f124579fb21e8de993710735127531f97104a2d151b4bf9eee394bc1a6a@sethmartin.us This item expands on clicking expand but does not expand completely -> not the whole image is visible.

it only seems to happen when images are involved...

pafcu commented 9 years ago

See https://zothub.com/display/e95a8af4b8c21404ea226dc4ba392bd47052ee7a9da405ad458554a34aed77b0@zothub.com?zid=pafcu%40friendicared.de

I haven't been able to reproduce it on my own server (despite trying with large images), and thought that commit cce51f5a49c23d25d9fced179710b6f661463a35 would fix it. Can you confirm that this is not the case?

pafcu commented 9 years ago

I'm 99% sure it's because for some reason the calculation of the expanded box is incorrect. The above referenced commit is supposed to recalculate it when expanding/collapsing. I tried asking upstream about why this calculation is even needed, but have not received a reply. If I don't hear anything soon, I'll just remove it, since it might only be needed in some corner case we don't care about (the old divgrow didn't calculate it either).

git-marijus commented 9 years ago

the site in the examples is running 2015-01-12.917R+e528483 so your possible fix is already in there. it works perfectly well in firefox but not in webkit based browsers (tested with chromium-39 and epiphany-3.14).

pafcu commented 9 years ago

OK, I'll take another look at it to see if I can reproduce the problem on my own test server.

git-marijus commented 9 years ago

what browser are you using?

pafcu commented 9 years ago

I can see the problem with Webkit based browsers when people are complaining, but I can't seem to be able to create a post on my own server which would display the problem. I tried creating dozens of posts with large images, long texts, etc. but it always seems to work, no matter what browser I try with. Probably the bug is not so easy to trigger since some reports said it's "rare".

git-marijus commented 9 years ago

it's not as rare as i thought at first... it's about 50/50 of the cases at the site i mentioned above. cant see a pattern though...

pafcu commented 9 years ago

Does it at least always occur or not occur with the same content? Or is it really non-deterministic?

git-marijus commented 9 years ago

it happens always with the same content.

pafcu commented 9 years ago

Right. Could you maybe paste the source for one non-working post here, so I can test that?

git-marijus commented 9 years ago

[share author='Seth+Martin' profile='https://sethmartin.us/channel/seth' avatar='https://red.mrjive.eu/photo/a1064c87fb7907f628ccd69ffe1200aa-6' link='https://sethmartin.us/channel/seth/?f=&mid=6f7a7f2bb929c7c7be0645a825ea71c35cfe4e9df8248e38dcacbd5b3f2300c9@sethmartin.us' posted='2015-01-15 00:51:20' message_id='6f7a7f2bb929c7c7be0645a825ea71c35cfe4e9df8248e38dcacbd5b3f2300c9@sethmartin.us']

^[url=http://www.geeksaresexy.net/2015/01/14/using-google-comic/]Using The Google [Comic][/url]

[url=http://www.geeksaresexy.net/2015/01/14/using-google-comic/][img=600x2507]http://gaspull.geeksaresexytech.netdna-cdn.com/wp-content/uploads/2015/01/google-comic.jpg[/img]

[/url]

[quote][Via Reddit][/quote][/share]

pafcu commented 9 years ago

OK, using that code I get the error too. Should help with debugging. Thanks!

pafcu commented 9 years ago

The problem seems to be that the code relies on inserting a (somewhat modified) copy of the original element, and then calculating the height of it. In FF it's possible to do the calculation, but on webkit the call that inserts the copy returns before the copy has actually been inserted, so the height calculation fails.

It should be fixed now, by just making the calculation on the original element. However, I don't think it's a terribly good idea to make modifications like that without actually understanding why the author felt making a copy was needed in the first place. Unless upstream provides a good explanation, I'll probably start looking for a higher-quality library.

git-marijus commented 9 years ago

seems fixed

ghost commented 9 years ago

This issue was moved to redmatrix/redmatrix#294