I have the following component in my dev org:
<aura:component implements='forceCommunity:availableForAllPageTypes' access='global'>
<div aura:id='myDiv' id='myDiv' access='global'>Hello World!</div>
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
</aura:component>
with the following controller:
({
doInit : function(component, event, helper) {
var content = component.find('myDiv');
debugger;
}
})
EDIT: and the following renderer:
({
afterRender: function(component, helper) {
var ret = component.superAfterRender();
var content = component.find('myDiv');
debugger;
return ret;
},
render: function(component, helper) {
var ret = component.superRender();
var content = component.find('myDiv');
debugger;
return ret;
},
rerender: function(component, helper) {
var ret = component.superRerender();
var content = component.find('myDiv');
debugger;
return ret;
},
})
When I activate locker service, the content of my content
variable in my controller is a
"SecureComponentRef: markup://aura:html {8:68;a} {myDiv}{ key: {"namespace":"myNamespace"} }"
On a SecureComponentRef
there isn't any getElement()
or getElements
methods to access the DOM (to then bind some script).
I've tried the same function in different events, but I always get the Ref
.
Being in the same namespace (aka the same component), why can't I access the SecureComponent
instead?
(@Doug seems to say I should be able here: Why do some lightning components have more methods / properties than others)