Jump to content
Search Community

Payman

Business
  • Posts

    23
  • Joined

  • Last visited

Posts posted by Payman

  1. Finally, I figured out what is going on. Here is the codepan - 

    See the Pen Ljxpjv by anon (@anon) on CodePen

     

    Basically I am building a scene with dynamically loaded SVGs in a hidden div and then reveal the scene to  a user. Apparently firefox fails to provide BBox from the hidden div. GSAP on the other hand mistakenly trying to get a BBox on a root SVG element when there is no need for it at all (I think).

    • Like 1
  2. Here is what I see so far:

    1) TweenMax tries to parse transforms _getTransform

    2) It checks whether it is SVG or not using _isSVG function

    3) This is the code of this function, you can see it tries to use getBBox even though it might be a root svg element:

    return !!(_SVGElement && e.getCTM && _getBBox(e) && (!e.parentNode || e.ownerSVGElement))

    4) This results in triggering e.getBBox(), which ... fails! So it now goes to the _getBBoxHack and uses "this.ownerSVGElement" which is null and  should not be used

    Here is the error of  getBBox (note that svg does NOT have any "display:none;" style and svg .is(':visible') is true)

     

    1.png

     

    After a quick googling I saw people getting this bbox error after inserting svg via ajax, so that's might be a root of the problem, I will check it later. Anyways I feel like _isSVG function's way of doing things looks pretty questionable to me. Let me know your thoughts! 

     

    PS. Could you explain to me the meaning of this code? Thx! And why do you need to check getCTM twice in a row?:

    _SVGElement && e.getCTM

     

  3. Quote

    That doesn't make any sense. JavaScript is completely synchronous, and so is inserting an svg like you're doing. And the ownerSVGElement is supposed to be null on an svg element that is not inside another svg. It has nothing to do with being inside an HTML element. 

    I don't think issue happens because of javascript, most likely it is the repaints and layout recalculations delay.

    Quote

    That error clearly shows it's a root svg element, so the question is why is getBBox being called on it? But I don't know enough about how the CSSPlugin works to answer that.

    I agree, doesn't make sense for me either why gsap decided to getBBox on a root element, I will take a deeper look into it, thanks for advice!

  4. 4 minutes ago, GreenSock said:

    Okay, well thanks for trying anyway. I did notice a few problems with that codepen: 

    • You're using the "/latest/" CDN URL which hasn't been supported in years. You should switch to /1.20.2/. 
    • You're using the same ID on multiple elements. 

    If you're ever able to reproduce the problem, please do let us know. I'd love to see what's going on under the hood. Cheers!

    This is your  Basic Starter Pen, I did not change any external javascript urls, so you might need to tweak it.

     

  5. Quote

    I'm a bit concerned that perhaps you've got malformed SVG code. I could be wrong, of course - I just noticed that in your screen shot, the outerHTML shows <svg></rect></g> which is invalid. Maybe that's the problem? 

    That's just the way firefox shortens it, you can see "..." in the middle. The svg is valid.

    Quote

    Again, my goal here isn't just to throw a band-aid fix into the codebase. I prefer to really understand what's going on and why before I alter the codebase. Can you please provide a reduced test case in a codepen or jsfiddle? Is there any particular reason you're so reluctant to provide that? You don't even have to use your "real" artwork or code - it can be completely fictitious if you're worried about confidentiality or something. As long as it reproduces the problem, that's all we need.

    Ok, no worries, we will just use a modified version. I spent hours trying to create a reduced version, but no luck. This issue appears only in a fully fledged huge application, which I can not disclose. The troubling code itself is extremely simple and similar to this -

    See the Pen MvbzqB by anon (@anon) on CodePen

     There is just a delay that appears after inserting an SVG and e.getBBox() becomes available, so TweenMax falls-back to using always null ownerSVGElement. And as more stuff happens on the page, more this delay, so I can't even predict how big of a delay I should use. Sometimes it goes up to several seconds for some reason, which is not acceptable for smooth animations.  Again I won't bug you anymore with this, since I can't be helpful with replicating the issue. Thank you for you help anyways!

     

  6. The fix is really easy guys. If the issue is possible in a heavy application, because firefox is not very reliable, I don't see why wouldn't you implement it :

    var svg = _createElement("svg", this.ownerSVGElement && this.ownerSVGElement.getAttribute("xmlns") || "http://www.w3.org/2000/svg"),


     

  7. Quote

    That looks like this is happening due to the browser thinking the SVG element has no parent. 

    See for yourself, there is a parent and it's inside of the HTMLDocument. Do you have any other ideas what that could be?

    Screen Shot 2017-08-04 at 1.02.46 PM.png

  8. I can't create a codepan as I don't understand why it's happening but firefox spits errors ownerSVGElement is null for some dynamically generated inline svgs, I can get all the parents of svg using jquery .parents(), but this thing is always null. Old versions don't have this issue, can you guys make some sort check if it is null - avoid using it? Really desperately need this fix.

  9. I have a bunch of objects with inline style transforms (x,y,rotation) and gsap sometimes not picking up those transforms. So as a workaround I just use .set to let gsap know all the initial transform settings, however it triggers repaint and slows down everything a little bit because gsap replaces inline transforms with a matrix. Is there any way to let gsap know the initial coordinates and rotation, but not actually triggering repaint until any changes requested?

  10. There is a small arrow on the left side of the error description which you can use to show more details and find the original pen.js line that causing the error. 

    So in your case it is this line (TweenMax is not a timeline and you don't need to instantiate it). Besides you don't even use tm1 in your code.

    var tm1 = new TweenMax()

    The next error was a weird mix of jquery and native js selectors

    var main = document.getElementById($("#main"));

    should be just this:

    var main = $("#main");
    • Like 2
  11. Recently we decided to update all our greensock libraries and everything in our app became broken. So basically css plugin stopped applying styles after applying it once.

     

    See example:

     

    In the old version the text shadow was red, but in the new it remains black. Maybe I am doing something wrong, let me know. 

    See the Pen YWPaep by alecpro (@alecpro) on CodePen

×
×
  • Create New...