Use ampdoc API to check the tree position of the amp-animation element (#11523)
Use ampdoc API to check the tree position of the amp-animation element (#11523)

* Use ampdoc API to checking the tree position of the amp-animation element

* Check both ownerDocument.body and ampdoc.getBody

kixer-com/amphtml,yieldbot/amphtml,comScore/amphtml,comScore/amphtml,ADITION/amphtml,ampproject/amphtml,cvializ/amphtml,prateekbh/amphtml,kamtschatka/amphtml,keithwrightbos/amphtml,clawr/amphtml,gumgum/amphtml,camelburrito/amphtml,Gregable/amphtml,shawnbuso/amphtml,donttrustthisbot/amphtml,comScore/amphtml,honeybadgerdontcare/amphtml,clawr/amphtml,kixer-com/amphtml,techhtml/amphtml,sebastianbenz/amphtml,jpettitt/amphtml,cory-work/amphtml,nexxtv/amphtml,mhc-gh/amphtml,yieldmo/amphtml,adup-tech/amphtml,bpaduch/amphtml,luciancrasovan/amphtml,powdercloud/amphtml,gumgum/amphtml,jmadler/amphtml,lannka/amphtml,jpettitt/amphtml,shawnbuso/amphtml,sriramkrish85/amphtml,gumgum/amphtml,kamtschatka/amphtml,media-net/amphtml,yieldmo/amphtml,honeybadgerdontcare/amphtml,danielrozenberg/amphtml,BenDz/amphtml,rajkumarsrk/amphtml,yieldbot/amphtml,voyagegroup/amphtml,clawr/amphtml,kamtschatka/amphtml,koshka/amphtml,luciancrasovan/amphtml,prateekbh/amphtml,arealit/amphtml,lannka/amphtml,clawr/amphtml,ampproject/amphtml,sharethrough/amphtml,mhc-gh/amphtml,jridgewell/amphtml,media-net/amphtml,rajkumarsrk/amphtml,ampproject/amphtml,engtat/amphtml,powdercloud/amphtml,zhouyx/amphtml,lannka/amphtml,yieldmo/amphtml,zhangsu/amphtml,pedjoni8/amphtml,adiant/amphtml,vmarteev/amphtml,zhouyx/amphtml,widespace-os/amphtml,adup-tech/amphtml,mhc-gh/amphtml,prateekbh/amphtml,aghassemi/amphtml,yieldbot/amphtml,kamtschatka/amphtml,voyagegroup/amphtml,donttrustthisbot/amphtml,sebastianbenz/amphtml,ampproject/amphtml,adup-tech/amphtml,clawr/amphtml,erwinmombay/amphtml,zhucl/amphtml,camelburrito/amphtml,kixer-com/amphtml,nexxtv/amphtml,Gregable/amphtml,donttrustthisbot/amphtml,comScore/amphtml,jmadler/amphtml,sriramkrish85/amphtml,cory-work/amphtml,bpaduch/amphtml,gumgum/amphtml,BenDz/amphtml,voyagegroup/amphtml,yandex-pcode/amphtml,powdercloud/amphtml,adiant/amphtml,ADITION/amphtml,alanorozco/amphtml,engtat/amphtml,jridgewell/amphtml,BenDz/amphtml,cvializ/amphtml,prateekbh/amphtml,honeybadgerdontcare/amphtml,tlong2/amphtml,shawnbuso/amphtml,nexxtv/amphtml,aghassemi/amphtml,honeybadgerdontcare/amphtml,donttrustthisbot/amphtml,comScore/amphtml,ADITION/amphtml,sharethrough/amphtml,techhtml/amphtml,media-net/amphtml,lannka/amphtml,lannka/amphtml,chaveznvg/amphtml,kixer-com/amphtml,yieldmo/amphtml,adiant/amphtml,alanorozco/amphtml,engtat/amphtml,cory-work/amphtml,pedjoni8/amphtml,mhc-gh/amphtml,erwinmombay/amphtml,zhucl/amphtml,powdercloud/amphtml,engtat/amphtml,yandex-pcode/amphtml,aghassemi/amphtml,donttrustthisbot/amphtml,gumgum/amphtml,jridgewell/amphtml,engtat/amphtml,luciancrasovan/amphtml,alanorozco/amphtml,tlong2/amphtml,bpaduch/amphtml,shawnbuso/amphtml,jpettitt/amphtml,powdercloud/amphtml,koshka/amphtml,danielrozenberg/amphtml,luciancrasovan/amphtml,erwinmombay/amphtml,koshka/amphtml,jmadler/amphtml,jridgewell/amphtml,Gregable/amphtml,rajkumarsrk/amphtml,honeybadgerdontcare/amphtml,rajkumarsrk/amphtml,Gregable/amphtml,techhtml/amphtml,Gregable/amphtml,Gregable/amphtml,dotandads/amphtml,camelburrito/amphtml,alanorozco/amphtml,sebastianbenz/amphtml,zhouyx/amphtml,jmadler/amphtml,Gregable/amphtml,smartadserver/amphtml,arealit/amphtml,danielrozenberg/amphtml,mhc-gh/amphtml,widespace-os/amphtml,prateekbh/amphtml,sebastianbenz/amphtml,tlong2/amphtml,chaveznvg/amphtml,src-code/amphtml,donttrustthisbot/amphtml,luciancrasovan/amphtml,zhucl/amphtml,jridgewell/amphtml,BenDz/amphtml,arealit/amphtml,nexxtv/amphtml,bpaduch/amphtml,lannka/amphtml,laterpay/amphtml,cvializ/amphtml,gumgum/amphtml,chaveznvg/amphtml,kamtschatka/amphtml,clawr/amphtml,zhangsu/amphtml,sharethrough/amphtml,widespace-os/amphtml,jridgewell/amphtml,src-code/amphtml,rsimha-amp/amphtml,taboola/amphtml,kamtschatka/amphtml,alanorozco/amphtml,src-code/amphtml,comScore/amphtml,luciancrasovan/amphtml,danielrozenberg/amphtml,sebastianbenz/amphtml,widespace-os/amphtml,koshka/amphtml,laterpay/amphtml,yandex-pcode/amphtml,adiant/amphtml,keithwrightbos/amphtml,cvializ/amphtml,taboola/amphtml,yieldbot/amphtml,camelburrito/amphtml,BenDz/amphtml,laterpay/amphtml,cory-work/amphtml,powdercloud/amphtml,zhouyx/amphtml,camelburrito/amphtml,arealit/amphtml,jpettitt/amphtml,zhangsu/amphtml,zhucl/amphtml,nexxtv/amphtml,zhouyx/amphtml,luciancrasovan/amphtml,rsimha-amp/amphtml,cory-work/amphtml,jpettitt/amphtml,adiant/amphtml,sharethrough/amphtml,vmarteev/amphtml,zhucl/amphtml,yandex-pcode/amphtml,laterpay/amphtml,gumgum/amphtml,zhucl/amphtml,smartadserver/amphtml,vmarteev/amphtml,voyagegroup/amphtml,rsimha-amp/amphtml,sriramkrish85/amphtml,widespace-os/amphtml,jmadler/amphtml,rsimha-amp/amphtml,bpaduch/amphtml,pedjoni8/amphtml,erwinmombay/amphtml,kixer-com/amphtml,keithwrightbos/amphtml,jpettitt/amphtml,sriramkrish85/amphtml,vmarteev/amphtml,tlong2/amphtml,keithwrightbos/amphtml,prateekbh/amphtml,nexxtv/amphtml,powdercloud/amphtml,cory-work/amphtml,vmarteev/amphtml,jpettitt/amphtml,sharethrough/amphtml,danielrozenberg/amphtml,media-net/amphtml,techhtml/amphtml,arealit/amphtml,prateekbh/amphtml,vmarteev/amphtml,aghassemi/amphtml,kixer-com/amphtml,adiant/amphtml,pedjoni8/amphtml,danielrozenberg/amphtml,engtat/amphtml,yandex-pcode/amphtml,ampproject/amphtml,adup-tech/amphtml,ampproject/amphtml,bpaduch/amphtml,honeybadgerdontcare/amphtml,techhtml/amphtml,zhouyx/amphtml,pedjoni8/amphtml,sriramkrish85/amphtml,smartadserver/amphtml,vmarteev/amphtml,honeybadgerdontcare/amphtml,Gregable/amphtml,dotandads/amphtml,adup-tech/amphtml,chaveznvg/amphtml,koshka/amphtml,taboola/amphtml,taboola/amphtml,shawnbuso/amphtml,voyagegroup/amphtml,cory-work/amphtml,adiant/amphtml,cvializ/amphtml,chaveznvg/amphtml,adup-tech/amphtml,zhangsu/amphtml,voyagegroup/amphtml,lannka/amphtml,alanorozco/amphtml,widespace-os/amphtml,zhucl/amphtml,dotandads/amphtml,tlong2/amphtml,src-code/amphtml,media-net/amphtml,mhc-gh/amphtml,ADITION/amphtml,smartadserver/amphtml,techhtml/amphtml,camelburrito/amphtml,src-code/amphtml,media-net/amphtml,voyagegroup/amphtml,dotandads/amphtml,taboola/amphtml,danielrozenberg/amphtml,media-net/amphtml,keithwrightbos/amphtml,alanorozco/amphtml,yieldmo/amphtml,zhangsu/amphtml,ampproject/amphtml,laterpay/amphtml,comScore/amphtml,smartadserver/amphtml,alanorozco/amphtml,dotandads/amphtml,dotandads/amphtml,pedjoni8/amphtml,yandex-pcode/amphtml,yieldmo/amphtml,danielrozenberg/amphtml,media-net/amphtml,mhc-gh/amphtml,rajkumarsrk/amphtml,laterpay/amphtml,taboola/amphtml,aghassemi/amphtml,rsimha-amp/amphtml,aghassemi/amphtml,BenDz/amphtml,shawnbuso/amphtml,nexxtv/amphtml,arealit/amphtml,donttrustthisbot/amphtml,src-code/amphtml,sriramkrish85/amphtml,kixer-com/amphtml,rsimha-amp/amphtml,mhc-gh/amphtml,yieldbot/amphtml,jridgewell/amphtml,jpettitt/amphtml,yandex-pcode/amphtml,rsimha-amp/amphtml,jmadler/amphtml,taboola/amphtml,sharethrough/amphtml,smartadserver/amphtml,camelburrito/amphtml,erwinmombay/amphtml,zhangsu/amphtml,chaveznvg/amphtml,tlong2/amphtml,zhouyx/amphtml,shawnbuso/amphtml,yieldbot/amphtml,ADITION/amphtml,keithwrightbos/amphtml,keithwrightbos/amphtml,rajkumarsrk/amphtml,koshka/amphtml,bpaduch/amphtml,sebastianbenz/amphtml,arealit/amphtml,ampproject/amphtml,erwinmombay/amphtml,rajkumarsrk/amphtml,engtat/amphtml,cvializ/amphtml,clawr/amphtml,yieldmo/amphtml