{"id":1151,"date":"2022-08-30T15:13:14","date_gmt":"2022-08-30T15:13:14","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/aria-templates-warning-of-expression-is-null-or-undefined-in-debug-mode-for-a-template-file-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:13:14","modified_gmt":"2022-08-30T15:13:14","slug":"aria-templates-warning-of-expression-is-null-or-undefined-in-debug-mode-for-a-template-file-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/aria-templates-warning-of-expression-is-null-or-undefined-in-debug-mode-for-a-template-file-collection-of-common-programming-errors\/","title":{"rendered":"Aria Templates &#8211; Warning of &ldquo;expression is null or undefined&rdquo; in debug mode for a template file-Collection of common programming errors"},"content":{"rendered":"<p>In Aria Templates, whatever is done inside a TPL file should produce some output.<\/p>\n<p>The warning is to notify you that there might be an issue in your code, because<\/p>\n<ul>\n<li>you&#8217;re calling a function that doesn&#8217;t return (maybe you forgot to return)<\/li>\n<li>you&#8217;re using undefined variables<\/li>\n<li>you&#8217;re calling methods that are not used for producing markup<\/li>\n<\/ul>\n<p>The latter is more a design issue, methods that are not related to the view should be called in other places (<code>$dataReady<\/code>\/<code>$afterRefresh<\/code> and so on)<\/p>\n<p>If you&#8217;re fine with methods returning undefined you can either<\/p>\n<ul>\n<li>modify your method to return an empty string<\/li>\n<li>\n<p>use <code>eat<\/code> or <code>empty<\/code> template modifier<\/p>\n<p>${( function() { console.log(&#8220;passed&#8221;); } )()|eat}<\/p>\n<\/li>\n<\/ul>\n<p id=\"rop\"><small>Originally posted 2013-11-09 23:32:39. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>In Aria Templates, whatever is done inside a TPL file should produce some output. The warning is to notify you that there might be an issue in your code, because you&#8217;re calling a function that doesn&#8217;t return (maybe you forgot to return) you&#8217;re using undefined variables you&#8217;re calling methods that are not used for producing [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1151","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1151","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1151"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1151\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1151"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1151"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1151"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}