Question: > 
> **Possible Duplicate:**  
> 
> [Why can’t I have a direct reference to document.createElement?](https://stackoverflow.com/questions/3910171/why-cant-i-have-a-direct-reference-to-document-createelement) 
> 
> 
> 

I am quite new to Js and have been playing around with it.
Since `document.getElementById` & `doucment.createElement` is quite long I have decided to put it in a variable;
eg `var d = document.createElement;`

1. However when I call it like `var someElement = d("p");` I get "TypeError: Illegal invocation" and I'm not sure what that means.
2. If I separate the `document` object, `var d = document;` and then give that a property like so: `d.e = d.createElement;` then use it to create an element `someElement = d.e("p")` it works.

Can someone explain what causes 1. to fail and why 2. works?
Thank you in advance.

Answer: 
Init scripts might be the best way to go. Take a look at this chapter in the [User Guide](http://gradle.org/docs/current/userguide/init_scripts.html).

They provide a way for you to inject logic into all of your projects.
As explained in [the documentation](http://www.gradle.org/docs/current/userguide/userguide_single.html#mavenIvyRepositoriesNoAuth) and [about init scripts](https://docs.gradle.org/current/userguide/init_scripts.html):

Create a folders and file ending in `.gradle` e.g.: `~/.gradle/init.d/mirror.gradle`.
With content:

```
initscript {
  repositories {
     maven {
        url "http://repo.mycompany.com/maven2"
    }
  }
}

```