A spectral element method has been recently developed for solving elastodynamic problems. The numerical solutions are obtained by using the weak formulation of the elastodynamic equation for heterogeneous media, based on the Galerkin approach applied to a partition, in small subdomains, of the original physical domain. In this work, some mathematical aspects of the method and the associated algorithm implementation are systematically investigated. Two kinds of orthogonal basis functions, constructed with Legendre and Chebyshev polynomials, and their related Gauss-Lobatto collocation points are introduced. The related integration formulas are obtained. The standard error estimations and expansion convergence are discussed. An element-by-element pre-conditioned conjugate gradient linear solver in the space domain and a staggered predictor/multi-corrector algorithm in the time integration are used for strong heterogeneous elastic media. As a consequence, neither the global matrices nor the effective force vector is assembled. When analytical formulas are used for the element quadrature, there is even no need for forming element matrix in order to further save memory without losing much in computational efficiency. The element-by-element algorithm uses an optimal tensor product scheme which makes this method much more efficient than finite-element methods from the point of view of both memory storage and computational time requirements. This work is divided into two parts. The first part mainly focuses on theoretical studies with a simple numerical result for the Chebyshev spectral element, and the second part, mainly with the Legendre spectral element, will give the algorithm implementation, numerical accuracy and efficiency analyses, and then the detailed modeling example comparisons of the proposed spectral element method with a pseudo-spectral method, which will be seen in another work by Lin, Wang and Zhang.